-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nexus] Remove
v2p_notification_tx
(#5983)
Currently, a `tokio::sync::watch` channel is explicitly passed around to allow both Nexus and other background tasks to notify the `v2p_manager` background task. This must be passed explicitly through most of Nexus, which is a bit awkward. The new `background::Activator` API introduced in PR #5962 makes it a bit easier to nicely activate background tasks. Now, we have an `Activator` type which represents the `tokio::sync::Notify` used to wake the background task, and this can be passed into the various functions which must activate it. Because `Activator`s are constructed _before_ background tasks are started, the `Activator` can be passed to the background tasks that must activate the `v2p_manager` task (in this case, the `instance_watcher` task). This branch removes the `tokio::sync::watch` channel used to activate the `v2p_manager`, and replaces it with a use of the `Activator` API. Because the `Activator` type is not currently `Clone`, I refactored it slightly so that both the wired-up flag _and_ the `Notify` live within an `Arc`, allowing a clone of the `Activator` for the `v2p_manager` task to be passed into the `instance_watcher` task when it's constructed. I don't think this really introduces any new opportunities for accidental `Activator` misuse, as the assertion that an activator is not wired up twice still stands.
- Loading branch information
Showing
6 changed files
with
48 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters