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

@ -47,6 +47,7 @@ fn main() -> Result<()> {
}
async fn serve() -> Result<()> {
let stop = swarm_secret_client::shutdown_signal();
hive_log::init();
swarm_secret_client::install_crypto_provider();
let var = |name: &str| {
@ -92,7 +93,8 @@ async fn serve() -> Result<()> {
let mut requests = queue
.queue_subscribe(SUBJECT, QUEUE_GROUP.to_owned())
.await
.with_context(|| format!("subscribing to {SUBJECT}"))?;
.with_context(|| format!("subscribing to {SUBJECT}"))?
.take_until(stop.clone());
tracing::info!(subject = SUBJECT, "review classifier: awaiting try-outs");
let models = std::sync::Arc::new(models);
@ -115,7 +117,10 @@ async fn serve() -> Result<()> {
}
});
}
bail!("the subscription to {SUBJECT} ended")
if stop.peek().is_none() {
bail!("the subscription to {SUBJECT} ended");
}
Ok(())
}
/// Decode one request, answer it and log the run.