Watch
0
0
Fork
You've already forked hyperhive
0

queue consumers: stop taking messages on sigterm and exit 0

This commit is contained in:
atlas 2026-11-18 03:28:12 +01:00 • committed by mara
commit a8775f1a7a

View file

@ -115,6 +115,7 @@ async fn connect_queue(var: Var<'_>) -> Result<async_nats::Client> {
#[tokio::main]
async fn main() -> Result<()> {
let stop = swarm_secret_client::shutdown_signal();
hive_log::init();
swarm_secret_client::install_crypto_provider();
let var = |name: &str| {
@ -151,7 +152,8 @@ async fn main() -> Result<()> {
let mut requests = queue
.queue_subscribe(subject_wildcard(), QUEUE_GROUP.to_owned())
.await
.context("subscribing to the request subject")?;
.context("subscribing to the request subject")?
.take_until(stop.clone());
tracing::info!(
subject = subject_wildcard(),
"swarm-stt: answering requests"
@ -207,7 +209,10 @@ async fn main() -> Result<()> {
}
});
}
bail!("the request subscription ended")
if stop.peek().is_none() {
bail!("the request subscription ended");
}
Ok(())
}
/// One agent's place among the requests in flight; dropping it frees the place.