Log pending but not eligible items
This commit is contained in:
@@ -85,11 +85,17 @@ export async function runSynthesisCycle(provider: InferenceProvider, settings: G
|
|||||||
|
|
||||||
const holdMs = settings.holdBeforePublishMinutes * 60_000;
|
const holdMs = settings.holdBeforePublishMinutes * 60_000;
|
||||||
let published = 0;
|
let published = 0;
|
||||||
|
let pending = 0;
|
||||||
|
let earliestRemainingMs = Infinity;
|
||||||
|
|
||||||
for (const cluster of clusters) {
|
for (const cluster of clusters) {
|
||||||
const earliestFetch = Math.min(...cluster.items.map((i) => new Date(i.fetchedAt).getTime()));
|
const earliestFetch = Math.min(...cluster.items.map((i) => new Date(i.fetchedAt).getTime()));
|
||||||
const ready = Date.now() - earliestFetch >= holdMs;
|
const remaining = holdMs - (Date.now() - earliestFetch);
|
||||||
if (!ready) continue; // left unclustered — reconsidered next cycle, possibly with more corroborating items
|
if (remaining > 0) {
|
||||||
|
pending += cluster.items.length;
|
||||||
|
earliestRemainingMs = Math.min(earliestRemainingMs, remaining);
|
||||||
|
continue; // left unclustered — reconsidered next cycle, possibly with more corroborating items
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const article = await publishCluster(provider, settings, cluster);
|
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;
|
return published;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user