fix(nats): delete old push consumer before creating pull consumer
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m10s
test / unit (pull_request) Failing after 10m54s
test / integration (pull_request) Failing after 17m11s

This commit is contained in:
2026-05-14 23:07:05 +02:00
parent 17d2a186e1
commit 9bda23f187

View File

@@ -113,6 +113,17 @@ impl MessageSource for NatsMessageSource {
}
};
// Delete any existing push consumer with this name — can't reuse as pull.
// No-op if it doesn't exist or is already a pull consumer.
if let Ok(info) = stream.consumer_info(CONSUMER_NAME).await {
if info.config.deliver_subject.is_some() {
tracing::info!(
"deleting old push consumer '{CONSUMER_NAME}', replacing with pull"
);
let _ = stream.delete_consumer(CONSUMER_NAME).await;
}
}
let consumer = match stream
.get_or_create_consumer(
CONSUMER_NAME,