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

making gracefulClose more graceful #580

Merged

Conversation

kazu-yamamoto
Copy link
Collaborator

200ms is too long. So, wait for 1ms first, then 2ms, 4ms, 8ms, etc.

@kazu-yamamoto
Copy link
Collaborator Author

kazu-yamamoto commented Jun 10, 2024

@khibino This makes dug's time rag smaller. But we can still notice the time rag, I guess.

@edsko network-run uses gracefulClose in network. We feel a time rag when a client is finished because threadDelay with 200ms is used. This patch starts with 1ms and increments it exponentially.

Your opinions are highly welcome.

@edsko
Copy link

edsko commented Jun 11, 2024

Makes sense to me. I don't know how critical the maximum timeout out; as it stands, the patch might exceed it (by one round); could instead consider

let tmout' = tmout + delay
when (r == -1 && tmout' < tmout0) $ do
    threadDelay (delay * 1000)
    loop (delay * 2) tmout'

to check if the timeout that we are about to do would not exceed the max. But it probably doesn't really matter either way.

TL;DR: Fine with me :)

200ms is too long. So, wait for 1ms first, then 2ms, 4ms, 8ms, etc.
@kazu-yamamoto kazu-yamamoto force-pushed the gracefully-graceful-shutdown branch from b3c898e to 107486a Compare June 11, 2024 22:55
@kazu-yamamoto
Copy link
Collaborator Author

@edsko Thank you for your review.
I would like to merge this PR as is.

@kazu-yamamoto kazu-yamamoto merged commit a2e111e into haskell:master Jun 12, 2024
13 of 14 checks passed
@kazu-yamamoto kazu-yamamoto deleted the gracefully-graceful-shutdown branch June 12, 2024 00:09
@kazu-yamamoto
Copy link
Collaborator Author

Rebased and merged.

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.

3 participants