Pace candidate funnel to send capacity

This commit is contained in:
jjbrunton committed 2026-08-09 16:28:12 +01:00
1 parent 910576921b
commit 70c156e1f7
7 files changed
+113 -13

No files matched your search

+13
View File
@@ -77,10 +77,23 @@ describe('CandidateQueueRepository', () => {
duplicateAuthor: 1,
previouslyProcessed: 0,
previouslyContacted: 0,
deferredAtCapacity: 0,
});
expect(queue.getStats().byStatus.discovered).toBe(2);
});
it('fills only the requested intake deficit and reports untouched posts', () => {
const result = queue.enqueue([
post('p1', 'alice'),
post('p2', 'bob'),
post('p3', 'carol'),
], 'image', 1, 1_000, 2);
expect(result.discovered).toBe(2);
expect(result.deferredAtCapacity).toBe(1);
expect(queue.countActive()).toBe(2);
});
it('excludes posts and recipients already handled anywhere', () => {
db.prepare(`
INSERT INTO processed_posts (account_id, id, subreddit, author, title, processed_at)