Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add getCurrentUpdateInfo #2158

Merged
merged 12 commits into from
Aug 2, 2024

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Add getCurrentUpdateInfo().

closes #2093

Comment on lines 345 to 356
* <p>Note: Should only be called within the context of a workflow.
*
* @return current workflow info.
*/
public static WorkflowInfo getInfo() {
return WorkflowInternal.getWorkflowInfo();
}

/**
* Returns information about current workflow update.
*
* <p>Note: Should only be called within the context of a update handler thread in a workflow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might change both of these notes to "only returns non-null / filled option within the context.."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They actually throw an error if called outside a workflow context

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ok, even better to say that then

@Override
public String update(Integer index, String value) {
UpdateInfo updateInfo = Workflow.getCurrentUpdateInfo().get();
Workflow.sleep(Duration.ofMillis(100));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the sleep matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not for the test. I was thinking making the handler take more then one WFT would provide better coverage. Not sure if that is really true though.

@Quinn-With-Two-Ns Quinn-With-Two-Ns force-pushed the issue-2093 branch 2 times, most recently from d60d99a to 9ae2781 Compare August 2, 2024 04:20
@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit 5d22bb5 into temporalio:master Aug 2, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose UpdateID in an update handler
2 participants