Skip to content

Conversation

@Marpond
Copy link
Contributor

@Marpond Marpond commented Oct 24, 2025

What changed?
Introduces an abstraction of resetting timers via ResettableTimer in x/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. With ResettableTimer, a single Reset() 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.

Copy link
Member

@jakobht jakobht left a 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

@Marpond Marpond force-pushed the master branch 2 times, most recently from 8750ebf to 3b6e271 Compare November 4, 2025 13:06
@codecov
Copy link

codecov bot commented Nov 6, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.86%. Comparing base (30a4919) to head (d2e0ea2).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Coverage Δ
x/resettabletimer/resettable_timer.go 100.00% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30a4919...d2e0ea2. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#### Example: Inactivity Timeout with Dynamic Duration

```go
func InactivityTimeoutWorkflow(ctx workflow.Context) error {
Copy link
Member

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!

@jakobht jakobht merged commit f0ff1c0 into cadence-workflow:master Dec 16, 2025
11 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.

2 participants