Fix routing of leader updates from unshared projects

Previously, leader updates in unshared projects would be sent to
all followers regardless of project, as if they were not scoped
to any project.
This commit is contained in:
Max Brunsfeld 2024-01-11 13:41:28 -08:00
parent 7c817642b8
commit 258c2fdad4
5 changed files with 198 additions and 152 deletions

View file

@ -137,6 +137,8 @@ pub trait ResultExt<E> {
type Ok;
fn log_err(self) -> Option<Self::Ok>;
/// Assert that this result should never be an error in development or tests.
fn debug_assert_ok(self, reason: &str) -> Self;
fn warn_on_err(self) -> Option<Self::Ok>;
fn inspect_error(self, func: impl FnOnce(&E)) -> Self;
}
@ -159,6 +161,14 @@ where
}
}
#[track_caller]
fn debug_assert_ok(self, reason: &str) -> Self {
if let Err(error) = &self {
debug_panic!("{reason} - {error:?}");
}
self
}
fn warn_on_err(self) -> Option<T> {
match self {
Ok(value) => Some(value),