Unverified Commit 7ce8d0ef authored by Michael Feil's avatar Michael Feil Committed by GitHub
Browse files

feat: make connect_with_reset jetstream configurable (#3078)


Signed-off-by: default avatarmichaelfeil <me@michaelfeil.eu>
parent d49fc3eb
...@@ -514,12 +514,17 @@ impl NatsQueue { ...@@ -514,12 +514,17 @@ impl NatsQueue {
let client = client_options.connect().await?; let client = client_options.connect().await?;
// messages older than a hour in the stream will be automatically purged
let max_age = std::env::var("DYN_NATS_STREAM_MAX_AGE")
.ok()
.and_then(|s| s.parse::<u64>().ok())
.map(time::Duration::from_secs)
.unwrap_or_else(|| time::Duration::from_secs(60 * 60));
// Always try to create the stream (removes the race condition) // Always try to create the stream (removes the race condition)
let stream_config = jetstream::stream::Config { let stream_config = jetstream::stream::Config {
name: self.stream_name.clone(), name: self.stream_name.clone(),
subjects: vec![self.subject.clone()], subjects: vec![self.subject.clone()],
// messages older than a hour in the stream will be automatically purged max_age,
max_age: time::Duration::from_secs(60 * 60),
..Default::default() ..Default::default()
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment