Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions roles/webhook/files/src/restart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,13 @@ fn try_run(command: Option<&String>, service: &str) -> bool {
/// - `name`: Name of the service to restart
/// - `service`: Specific deployment configuration for that service.
/// - `default`: Default deployment configuration.
///
/// Holds `lock_state` for the full restart sequence so concurrent webhook
/// deliveries cannot run overlapping ansible-pull deploys (#193).
pub fn restart(name: &str, service: &Service, default: &Service, lock_state: Arc<Mutex<()>>) -> bool {
let _deploy_guard = lock_state.lock().unwrap_or_else(|e| e.into_inner());
let _enter = span!(Level::INFO, "service", name).entered();

if lock_state.lock().is_err() { // If another thread crashed, clear poison because we don't care
// about the state
lock_state.clear_poison();
}

tracing::info!("Restarting...");

let span = span!(Level::DEBUG, "stop_command").entered();
Expand Down Expand Up @@ -102,4 +101,4 @@ pub fn restart(name: &str, service: &Service, default: &Service, lock_state: Arc

tracing::info!("Completed !");
true
}
}