-
Notifications
You must be signed in to change notification settings - Fork 175
Add Nexus cancellation sample #718
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 Nexus cancellation sample #718
Conversation
| @Override | ||
| public NexusService.HelloOutput hello(NexusService.HelloInput input) { | ||
| // Sleep for a random duration to simulate some work | ||
| Workflow.sleep(Duration.ofSeconds(Workflow.newRandom().nextInt(5))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would encourage something a bit more deterministic here so that the same amount of cancellations happen every sample run (e.g. maybe pretend that EN is always slower or something)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, can do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know what you end up with and I'll update the Go sample. I kinda like that this isn't deterministic and you may get surprising results.
| // If the operation was cancelled, we can ignore the failure | ||
| if (e.getCause() instanceof CanceledFailure) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if we should log or otherwise make clear to a user that the cancel occurred. User may not need it in their workflow, but for the sample, it's hard to know that anything even got canceled without going to the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
Add Nexus cancellation sample