Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Nexus notification to standalone task (#1584)
Previously, we would spawn a new `tokio::task` in the `Downstairs` to do an async notification to Nexus, iff the `notify-nexus` feature was enabled. This is awkward for a few reasons: - Spawning tasks in an otherwise-synchronous function can be surprising (since it implicitly requires a tokio runtime) - It requires importing a bunch of Nexus types into the `mod downstairs` - This code was only compiled if `notify-nexus` is enabled, which means that it's easy to have something that builds locally but fails in CI - There's a bunch of duplicate logging, because each function notifies Nexus separately This PR moves Nexus notifications to a separate `notify` module, which runs a single task to do these notifications in one place. It communicates to the rest of Crucible through a queue; if the queue fills up, we log and discard the notification request (since this is best-effort). All of this code is _always_ compiled; we check the feature (using `cfg!(feature = "notify-nexus")` to determine whether it's actually enabled. This module is responsible for translating into Nexus types, so they don't leak into the rest of the codebase.
- Loading branch information