Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions queue/src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,17 @@ pub async fn build_store(config: &QueueConfig) -> anyhow::Result<Arc<dyn QueueSt
.file_path
.unwrap_or_else(|| "queue_store_data".to_string());
let save_interval_ms = builtin.save_interval_ms.unwrap_or(5000);
Ok(Arc::new(FileStore::open(path, save_interval_ms).await?))
let store = FileStore::open(&path, save_interval_ms).await?;
tracing::info!(store = "file_based", path = %path, "queue store ready");
Ok(Arc::new(store))
}
"builtin" | "in_memory" => {
tracing::info!(
store = "in_memory",
"queue store ready; jobs do not survive restarts"
);
Ok(Arc::new(InMemoryStore::new()))
}
"builtin" | "in_memory" => Ok(Arc::new(InMemoryStore::new())),
other => anyhow::bail!("unknown builtin queue store_method '{other}'"),
}
}
Expand Down
8 changes: 7 additions & 1 deletion queue/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ pub struct TopicStatsOutput {
pub depth: u64,
pub consumer_count: u64,
pub dlq_depth: u64,
pub delivered: u64,
pub failed: u64,
pub config: Option<Value>,
}

Expand Down Expand Up @@ -327,6 +329,8 @@ pub async fn topic_stats(
depth: stats.depth,
consumer_count: 0,
dlq_depth: stats.dlq_depth,
delivered: stats.delivered,
failed: stats.failed,
config: None,
})
}
Expand Down Expand Up @@ -713,7 +717,7 @@ mod tests {
*_mock.topic_stats_result.lock().unwrap() = Some(Ok(TopicStats {
depth: 1,
dlq_depth: 1,
delivered: 0,
delivered: 2,
failed: 1,
}));
let stats = topic_stats(
Expand All @@ -726,6 +730,8 @@ mod tests {
.unwrap();
assert_eq!(stats.depth, 1);
assert_eq!(stats.dlq_depth, 1);
assert_eq!(stats.delivered, 2);
assert_eq!(stats.failed, 1);
}

#[tokio::test]
Expand Down
9 changes: 9 additions & 0 deletions queue/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ async fn main() -> Result<()> {
.await
.map_err(anyhow::Error::msg)
.context("loading queue configuration")?;
if let Some(seed) = seed.as_ref() {
if seed.adapter != config.adapter {
tracing::warn!(
seed_adapter = ?seed.adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}
Comment on lines +92 to +100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Only compare adapters when the seed specifies one.

seed can be present while seed.adapter is None. In that case, this emits an “adapter ignored” warning when the stored configuration has an adapter, even though --config did not provide one. Gate the comparison on seed.adapter.is_some().

Proposed fix
     if let Some(seed) = seed.as_ref() {
-        if seed.adapter != config.adapter {
+        if let Some(seed_adapter) = seed.adapter.as_ref() {
+            if Some(seed_adapter) != config.adapter.as_ref() {
             tracing::warn!(
-                seed_adapter = ?seed.adapter,
+                seed_adapter = ?seed_adapter,
                 stored_adapter = ?config.adapter,
                 "--config seed adapter ignored; the stored configuration is authoritative"
             );
+            }
         }
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if let Some(seed) = seed.as_ref() {
if seed.adapter != config.adapter {
tracing::warn!(
seed_adapter = ?seed.adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}
if let Some(seed) = seed.as_ref() {
if let Some(seed_adapter) = seed.adapter.as_ref() {
if Some(seed_adapter) != config.adapter.as_ref() {
tracing::warn!(
seed_adapter = ?seed_adapter,
stored_adapter = ?config.adapter,
"--config seed adapter ignored; the stored configuration is authoritative"
);
}
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@queue/src/main.rs` around lines 92 - 100, Update the adapter comparison in
the seed validation block to run only when seed.adapter is Some, while
preserving the existing mismatch warning and stored-configuration authority
behavior for explicitly provided adapters.


let boot = iii_queue::boot::start(iii.clone(), config).await?;
configuration::register_config_trigger(
Expand Down
Loading