Skip to content

fix: don't sleep/block if ticks are outstanding#650

Open
dryajov wants to merge 1 commit into
status-im:masterfrom
durability-labs:fix/dont-sleep-with-ticks
Open

fix: don't sleep/block if ticks are outstanding#650
dryajov wants to merge 1 commit into
status-im:masterfrom
durability-labs:fix/dont-sleep-with-ticks

Conversation

@dryajov
Copy link
Copy Markdown
Contributor

@dryajov dryajov commented May 22, 2026

Prevent poll() from blocking when internal ticks are outstanding.

When cancelSoon() fails to deliver cancellation on the first try, it installs a tick callback. However, poll() ignores ticks when calculating the current timeout. If a long timeout is scheduled, poll() can block until that timeout expires or IO wakes up the loop.

Treat tick callbacks as outstanding work when calculating the current poll() timeout.

Comment thread tests/testtime.nim
fut3.completed() == true

test "Cancellation retry tick does not wait for next timer":
const NextTimerSleep = 50.milliseconds
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const NextTimerSleep = 50.milliseconds
const NextTimerSleep = 500.milliseconds

@arnetheduck
Copy link
Copy Markdown
Member

arnetheduck commented May 30, 2026

hm, that's a lot of test failures .. almost looks like it was going into a busy loop sometimes

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