Skip to content

Handle potential overflow gracefully#68

Merged
jxs merged 1 commit into
async-rs:masterfrom
nazar-pc:handle-overflow-gracefully
May 19, 2026
Merged

Handle potential overflow gracefully#68
jxs merged 1 commit into
async-rs:masterfrom
nazar-pc:handle-overflow-gracefully

Conversation

@nazar-pc
Copy link
Copy Markdown
Contributor

I had a use case to use Duration::MAX with one of the libraries using delay internally to effectively disable a delayed operation and hit overflow.

This simple change effectively makes addition saturating (unfortunately standard library didn't have a convenient method for it).

rename max_instance to far_future and update impl
@jxs jxs force-pushed the handle-overflow-gracefully branch from cf390d5 to c65fe74 Compare May 19, 2026 16:49
Copy link
Copy Markdown
Collaborator

@jxs jxs left a comment

Choose a reason for hiding this comment

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

Thanks Nazar!

@jxs jxs merged commit 827aaf3 into async-rs:master May 19, 2026
4 checks passed
@nazar-pc nazar-pc deleted the handle-overflow-gracefully branch May 21, 2026 01:04
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