From d16cd508b54000beb772192f1c50c5077670788e Mon Sep 17 00:00:00 2001 From: Salastil Date: Fri, 17 Jul 2026 10:49:09 -0400 Subject: [PATCH] Log pending but not eligible items --- backend/src/queue/priorityQueue.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/src/queue/priorityQueue.ts b/backend/src/queue/priorityQueue.ts index 9ba1b22..a9826c9 100644 --- a/backend/src/queue/priorityQueue.ts +++ b/backend/src/queue/priorityQueue.ts @@ -85,11 +85,17 @@ export async function runSynthesisCycle(provider: InferenceProvider, settings: G const holdMs = settings.holdBeforePublishMinutes * 60_000; let published = 0; + let pending = 0; + let earliestRemainingMs = Infinity; for (const cluster of clusters) { const earliestFetch = Math.min(...cluster.items.map((i) => new Date(i.fetchedAt).getTime())); - const ready = Date.now() - earliestFetch >= holdMs; - if (!ready) continue; // left unclustered — reconsidered next cycle, possibly with more corroborating items + const remaining = holdMs - (Date.now() - earliestFetch); + if (remaining > 0) { + pending += cluster.items.length; + earliestRemainingMs = Math.min(earliestRemainingMs, remaining); + continue; // left unclustered — reconsidered next cycle, possibly with more corroborating items + } try { const article = await publishCluster(provider, settings, cluster); @@ -107,5 +113,13 @@ export async function runSynthesisCycle(provider: InferenceProvider, settings: G } } + if (published === 0 && pending > 0) { + const minutesLeft = Math.ceil(earliestRemainingMs / 60_000); + logger.info( + 'synthesis', + `${pending} item(s) ingested, waiting on hold-before-publish (~${minutesLeft}m remaining on the earliest)` + ); + } + return published; -} +} \ No newline at end of file