Skip to content

Commit 2036189

Browse files
committed
fix: ensure delivery of stop signal in scheduler by using await for command transmission
1 parent e0d7c02 commit 2036189

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/scheduler.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,10 @@ where
389389
///
390390
/// - [`CanoError::Workflow`] — the scheduler is not running
391391
pub async fn stop(&self) -> CanoResult<()> {
392-
// Send stop signal — non-blocking; fails immediately if channel is full or disconnected
392+
// Send stop signal — use send().await to ensure delivery for critical control-plane command.
393+
// This is safe because stop signals are rare and waiting for queue space is acceptable.
393394
if let Some(tx) = self.command_tx.read().await.as_ref() {
394-
tx.try_send(SchedulerCommand::Stop)
395+
tx.send(SchedulerCommand::Stop).await
395396
.map_err(|e| CanoError::Workflow(format!("Failed to send stop: {}", e)))?;
396397
} else {
397398
return Err(CanoError::Workflow(

0 commit comments

Comments
 (0)