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

Eagerly remove Handles from the manager #986

Conversation

FinleyMcIlwaine
Copy link
Contributor

@FinleyMcIlwaine FinleyMcIlwaine commented Apr 26, 2024

This PR is based on #985. That should be merged first, then this can be rebased on main and merged.

Previously, if many streams were opened on a connection with a very long timeout, the handles would accumulate. This PR causes the handles to be removed from the manager immediately upon cancel, instead of relying on timeouts causing the reaper to remove them.

Before submitting your PR, check that you've:

  • Bumped the version number

After submitting your PR:

  • Update the Changelog.md file with a link to your PR

@FinleyMcIlwaine FinleyMcIlwaine force-pushed the finley/eager-handle-deletion branch 4 times, most recently from b46f16a to 8812303 Compare April 26, 2024 22:55
It is convenient to be able to modify reaper workloads outside of the
`reaperAction` in scenarios where we don't want to wait for `reaperDelay` for
the jobs to be updated. This PR adds an atomic `reaperModify` function to the
reaper API which enables this.

Since this changes the visible `Reaper` constructor, I did a major version bump
(`auto-update` 0.1.6 -> 0.2.0) and added a changelog entry. I also bumped the
`warp` dependency on `auto-update`.
`cancel` used to mark the given `Handle` as `Canceled`, which relied on the
reaper to run and clean up the `Canceled` handles. This is not good for long
timeouts when many streams are opened, as a lot of `Canceled` handles build up
in the reaper's workload. This commit uses the reaper's new `reaperModify` API
to immediately remove the given `Handle` in `cancel`. This obsoletes the
`Canceled` constructor of `State`, so we remove that as well.

We update the time-manager dependency of warp to include the new changes as
well.

The related auto-update changes are in PR yesodweb#985.
Copy link
Contributor

@kazu-yamamoto kazu-yamamoto left a comment

Choose a reason for hiding this comment

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

Excellent!

kazu-yamamoto added a commit to kazu-yamamoto/wai that referenced this pull request Apr 27, 2024
@kazu-yamamoto
Copy link
Contributor

Rebased and merged.
Thank you for your contribution!

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.

None yet

2 participants