Skip to content

Commit

Permalink
Ensure we always call shut_down on GitHub queue in broker
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbobbio committed Jan 1, 2025
1 parent 189ec4a commit 77d807d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/maelstrom-broker/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ async fn unassigned_github_connection_main<TempFileT>(
info!(log, "worker connected");
let log_clone = log.clone();
let log_clone2 = log.clone();

let write_queue = Arc::new(tokio::sync::Mutex::new(write_queue));
let write_queue_clone = write_queue.clone();
connection_main(
scheduler_sender,
id,
Expand All @@ -306,13 +309,15 @@ async fn unassigned_github_connection_main<TempFileT>(
.await;
},
|scheduler_receiver| async move {
let mut write_queue = write_queue_clone.lock().await;
let _ =
net::github_queue_writer(scheduler_receiver, &mut write_queue, &log_clone2)
.await;
},
)
.await;
info!(log, "worker disconnected");
let _ = write_queue.lock().await.shut_down().await;

return;
}
Expand Down

0 comments on commit 77d807d

Please sign in to comment.