Skip to content

Commit

Permalink
fix(ds): allow destroy early during retry backoff (#1718)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
Fixes RVT-4415
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Jan 2, 2025
1 parent 3841840 commit 3c6da10
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/services/ds/src/workflows/server/pegboard/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use cluster::types::BuildDeliveryMethod;
use futures_util::FutureExt;
use pegboard::protocol as pp;
use serde_json::json;
use tokio::time::Instant;
use util::serde::AsHashableExt;

use super::{
Expand Down Expand Up @@ -757,9 +758,13 @@ async fn reschedule_actor(
(retry_count - 1).try_into()?,
);
let next = backoff.step().expect("should not have max retry");

// Sleep for backoff or destroy early
if let Some(sig) = ctx.listen_with_timeout::<Destroy>(next - Instant::now()).await? {
tracing::debug!("destroying before actor start");

// Sleep for backoff
ctx.sleep_until(next).await?;
return Ok(Loop::Break(Some(sig)));
}
}

spawn_actor(ctx, &input, &actor_setup).await?;
Expand Down

0 comments on commit 3c6da10

Please sign in to comment.