feat: configure ready outreach funnel limit

This commit is contained in:
jjbrunton committed 2026-08-09 16:13:58 +01:00
1 parent 22eb32e5bf
commit e9083281a8
15 files changed
+66 -11

No files matched your search

+2 -3
View File
@@ -429,7 +429,6 @@ async function runConcurrentAccountRuntimes(app: AppContainer): Promise<void> {
const workerInstance = `candidate-funnel-${process.pid}-${Date.now()}`;
const leaseMs = 5 * 60_000;
const maxActiveCandidates = 500;
const readyTarget = 100;
const recovered = candidateQueueRepo.recoverAllLeases();
app.recipientDeduplicator.recoverStaleReservations(Date.now() - 10 * 60_000);
logger.info(
@@ -527,7 +526,7 @@ async function runConcurrentAccountRuntimes(app: AppContainer): Promise<void> {
candidateQueueRepo.expireStale(
Date.now() - config.reddit.recentWindowMinutes * 60_000,
);
if (candidateQueueRepo.countReady() >= readyTarget) {
if (candidateQueueRepo.countReady() >= config.reddit.maxReadyCandidates) {
await sleep(2_000, controller.signal).catch(() => undefined);
continue;
}
@@ -590,7 +589,7 @@ async function runConcurrentAccountRuntimes(app: AppContainer): Promise<void> {
await sleep(1_000, controller.signal).catch(() => undefined);
continue;
}
candidateQueueRepo.promoteDueRetries();
candidateQueueRepo.promoteDueRetries(config.reddit.maxReadyCandidates);
candidateQueueRepo.recoverExpiredLeases();
app.recipientDeduplicator.recoverStaleReservations(Date.now() - 10 * 60_000);
const recipients = await availableRecipients();