- Notifications
You must be signed in to change notification settings - Fork14
refactor: Lightweight watcher#101
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:entity-manager
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Since we are guaranteed to be single threaded within the handler fns for asingle hash, we can use a much more lightweight watcher impl.Also, tokio::sync::watch is optimized for the case where there are a lotof parallel watchers, using a giant BigNotify internally. We want tooptimize for the case where there are just 0 or a few watchers, so we arenot that much concerned with the thundering herd problem.
github-actionsbot commentedJul 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Documentation for this PR has been generated and is available at:https://n0-computer.github.io/iroh-blobs/pr/101/docs/iroh_blobs/ Last updated: 2025-07-11T06:43:43Z |
_state: entity_manager::ActiveEntityState<Self>, | ||
_cause: entity_manager::ShutdownCause, | ||
) { | ||
async fn on_shutdown(state: HashContext, cause: ShutdownCause) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Unrelated change!
Did a very superficial bench with the linux kernel. Doesn't seem to make perf worse, but also not better (not that I expected that...) |
Uh oh!
There was an error while loading.Please reload this page.
Description
In the current blobs I am using tokio::sync::watch for notifying the observers when the state for a hash has changed. This works, but is way more heavy than needed.
Breaking Changes
None
Notes & open questions
Change checklist