From be777c0b4891500127cd97fdede74667f87f54fe Mon Sep 17 00:00:00 2001 From: kjuulh Date: Wed, 7 Jan 2026 09:55:34 +0100 Subject: [PATCH] chore: refactor code Signed-off-by: kjuulh --- crates/nocontrol/src/control_plane/reconciler.rs | 12 ++++++------ crates/nocontrol/src/reconcile_queue.rs | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/nocontrol/src/control_plane/reconciler.rs b/crates/nocontrol/src/control_plane/reconciler.rs index 640ea69..d071c7f 100644 --- a/crates/nocontrol/src/control_plane/reconciler.rs +++ b/crates/nocontrol/src/control_plane/reconciler.rs @@ -147,12 +147,12 @@ impl Reconciler { async fn enqueue_all_manifests(&self) -> anyhow::Result<()> { for manifest_state in self.store.get_owned_and_potential_leases().await? { // Only enqueue manifests we own - if let Some(lease) = &manifest_state.lease { - if lease.owner == self.worker_id { - self.reconcile_queue - .enqueue(manifest_state.manifest.name.clone()) - .await; - } + if let Some(lease) = &manifest_state.lease + && lease.owner == self.worker_id + { + self.reconcile_queue + .enqueue(manifest_state.manifest.name.clone()) + .await; } } diff --git a/crates/nocontrol/src/reconcile_queue.rs b/crates/nocontrol/src/reconcile_queue.rs index f26e2cc..e26471c 100644 --- a/crates/nocontrol/src/reconcile_queue.rs +++ b/crates/nocontrol/src/reconcile_queue.rs @@ -167,11 +167,13 @@ impl ReconcileQueue { } } + #[cfg(test)] /// Returns the number of pending jobs in the queue. pub async fn len(&self) -> usize { self.inner.lock().await.queue.len() } + #[cfg(test)] /// Returns true if the queue is empty. pub async fn is_empty(&self) -> bool { self.inner.lock().await.queue.is_empty()