chore: refactor code

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2026-01-07 09:55:34 +01:00
parent dfe81d979e
commit be777c0b48
2 changed files with 8 additions and 6 deletions

View File

@@ -147,14 +147,14 @@ impl<T: Operator> Reconciler<T> {
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 {
if let Some(lease) = &manifest_state.lease
&& lease.owner == self.worker_id
{
self.reconcile_queue
.enqueue(manifest_state.manifest.name.clone())
.await;
}
}
}
Ok(())
}

View File

@@ -167,11 +167,13 @@ impl<T: Specification> ReconcileQueue<T> {
}
}
#[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()