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

feat(timers): enabling simple timers #308

Merged
merged 10 commits into from
May 6, 2024
Merged

feat(timers): enabling simple timers #308

merged 10 commits into from
May 6, 2024

Conversation

guergabo
Copy link
Contributor

@guergabo guergabo commented May 3, 2024

Changes

This PR introduces a new resonate:timeout tag.

Context

The new tag enables distinct behaviors between vanilla promises and simple timeout promises:

  • When a vanilla promise timeouts, its state will be updated to REJECTED_TIMEDOUT
  • When a simple timeout promise timeouts, its state will be updated to RESOLVED

This distinction will allow events to be tied to the timeout of a promise.

@guergabo guergabo self-assigned this May 3, 2024
@guergabo guergabo added the enhancement New feature or request label May 3, 2024
@guergabo guergabo requested a review from dfarr May 3, 2024 15:14
Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 17 lines in your changes are missing coverage. Please review.

Project coverage is 57.82%. Comparing base (c73a3b4) to head (98850b7).
Report is 2 commits behind head on main.

Files Patch % Lines
...rnal/app/subsystems/aio/store/postgres/postgres.go 0.00% 6 Missing ⚠️
internal/app/coroutines/completePromise.go 0.00% 3 Missing ⚠️
internal/app/coroutines/createPromise.go 0.00% 3 Missing ⚠️
internal/app/coroutines/readPromise.go 0.00% 3 Missing ⚠️
test/dst/model.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #308      +/-   ##
==========================================
- Coverage   58.46%   57.82%   -0.65%     
==========================================
  Files         113      113              
  Lines        9776     9794      +18     
==========================================
- Hits         5716     5663      -53     
- Misses       3693     3771      +78     
+ Partials      367      360       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dfarr
Copy link
Member

dfarr commented May 4, 2024

Okay hear me out, not sure if this is possible...

What if we define a stored column (similar to invocation) and cast it to an integer corresponding to the State enum. If there is no tag set, we default this value to 16 (timedout). This way, we can always just refer to this column to set the state of the promise on timeout. On an API level we could validate that this value is either {resovled,timedout} (and map those to their corresponding integers), but this would also future proof our server with the ability to transition to any state on timedout if desired. What do you think?

@guergabo
Copy link
Contributor Author

guergabo commented May 6, 2024

Going the tag route, move invocation to tags.

@guergabo guergabo requested a review from dfarr May 6, 2024 18:52
@guergabo
Copy link
Contributor Author

guergabo commented May 6, 2024

Ready for review.

@guergabo guergabo merged commit 6bb17c4 into main May 6, 2024
3 of 5 checks passed
@guergabo guergabo deleted the simple-timers branch May 6, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants