Skip to content

Commit

Permalink
Remove infinite retry policy when announcing the leadership
Browse files Browse the repository at this point in the history
Instead of retrying infinitely in the LeadershipState, we are now spawning a
background appender and hand the announce leadership message over. Additionally,
we are now monitoring the health of the appender task to escalate potential
failures which would then result in shutting the PP down and let the PPM handle
the situation.

This fixes restatedev#2333.
  • Loading branch information
tillrohrmann committed Nov 22, 2024
1 parent ecc429b commit 1f99db0
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 216 deletions.
9 changes: 7 additions & 2 deletions crates/bifrost/src/background_appender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ where
}

/// Start the background appender as a TaskCenter background task. Note that the task will not
/// autmatically react to TaskCenter's shutdown signal, it gives control over the shutdown
/// behaviour to the the owner of [`AppenderHandle`] to drain or drop when appropriate.
/// automatically react to TaskCenter's shutdown signal, it gives control over the shutdown
/// behaviour to the owner of [`AppenderHandle`] to drain or drop when appropriate.
pub fn start(
self,
task_center: TaskCenter,
Expand Down Expand Up @@ -213,6 +213,11 @@ impl<T> AppenderHandle<T> {
pub fn sender(&self) -> &LogSender<T> {
self.sender.as_ref().unwrap()
}

/// Polls the underlying appender task to check whether it has finished or not.
pub async fn poll_appender_task(&mut self) -> Result<()> {
self.inner_handle.as_mut().expect("must be present").await?
}
}

#[derive(Clone)]
Expand Down
Loading

0 comments on commit 1f99db0

Please sign in to comment.