Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(activity): Export some of activity.Context members at module level #1252

Merged
merged 6 commits into from
Oct 17, 2023

Conversation

mjameswh
Copy link
Contributor

@mjameswh mjameswh commented Sep 26, 2023

What changed

  • The @temporalio/activity module now exports activityInfo(), log, sleep(), heartbeat(), cancelled and cancellationSignal, avoiding the necessity of spreading the activity context in activity code to reach those.

  • Marked most fields of Context, ActivityInfo, WorkflowInfo and others as readonly.

  • Modified the way WorkflowInfo is updated internally by the SDK, so that the structure is copy-on-write; this should significantly reduce the number of time that object needs to be deep cloned (eg. it was previously cloned on every sink call).

Why

@mjameswh mjameswh marked this pull request as ready for review October 12, 2023 20:38
@mjameswh mjameswh requested a review from a team as a code owner October 12, 2023 20:38
packages/activity/src/index.ts Outdated Show resolved Hide resolved
packages/activity/src/index.ts Show resolved Hide resolved
packages/activity/src/index.ts Outdated Show resolved Hide resolved
packages/worker/src/workflow/threaded-vm.ts Outdated Show resolved Hide resolved
packages/workflow/src/internals.ts Outdated Show resolved Hide resolved
@mjameswh mjameswh merged commit b649606 into temporalio:main Oct 17, 2023
24 checks passed
@mjameswh mjameswh deleted the activity-ctx-on-module branch October 17, 2023 22:01
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Properties of WorkflowInfo and Activity.Context should not be mutable by user code
2 participants