-
Notifications
You must be signed in to change notification settings - Fork 145
feat: add ResettableTimer for simplified timer management #1467
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
base: master
Are you sure you want to change the base?
Conversation
jakobht
left a comment
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.
Looks good. Added a few suggestions.
I think lets put this in the x/resettabletimer package since it's on top of the basic client
8750ebf to
3b6e271
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project check has failed because the head coverage (83.80%) is below the target coverage (85.00%). You can increase the head coverage or adjust the target coverage.
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
0706785 to
8648fd4
Compare
| #### Example: Inactivity Timeout with Dynamic Duration | ||
|
|
||
| ```go | ||
| func InactivityTimeoutWorkflow(ctx workflow.Context) error { |
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.
I like this example! Nice!
Signed-off-by: Marpond <[email protected]>
What changed?
Introduces an abstraction of resetting timers via
ResettableTimerinx/resettabletimer.Why?
Simplifies common timer patterns where timers need to be updated or extended. Previously, we had to manually cancel the existing timer context, handle
CanceledError, and create a new timer. WithResettableTimer, a singleReset()call handles this automatically.How did you test it?
Added workflow unit tests to ensure functional correctness and deterministic replay behavior.
Potential risks
Low risk. Does not alter current timer behavior, only adds a user-friendly interface built on existing timer primitives.