Prioritize growth retries and randomize intake
This commit is contained in:
1 parent
b949b6ee37
commit
e2d7dc4b82
11 files changed
+142
-4
No files matched your search
@@ -276,6 +276,34 @@ describe('growth route', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('DELETE /api/growth/:accountId/queue', () => {
|
||||
it('clears queued and retryable items without deleting posted history', async () => {
|
||||
repo.enqueueDiscovered(ACCOUNT, [
|
||||
thread('queued'),
|
||||
{ ...thread('posted'), created_utc: 1_800_000 },
|
||||
], 1_000);
|
||||
repo.claimNext(ACCOUNT, 'worker', 60_000, 1_000);
|
||||
repo.markPosted(ACCOUNT, 'posted', 'worker', {
|
||||
generatedComment: 'A posted comment',
|
||||
modelId: 'model',
|
||||
commentFullname: 't1_posted',
|
||||
commentPermalink: null,
|
||||
nextVerifyAt: 5_000,
|
||||
}, 2_000);
|
||||
|
||||
const { status, json } = await call(app, 'DELETE', `/api/growth/${ENCODED}/queue`);
|
||||
|
||||
expect(status).toBe(200);
|
||||
expect(json).toMatchObject({ success: true, cleared: 1 });
|
||||
expect(repo.get(ACCOUNT, 'queued')).toBeNull();
|
||||
expect(repo.get(ACCOUNT, 'posted')?.status).toBe('posted');
|
||||
expect(pushed).toContainEqual({
|
||||
level: 'warn',
|
||||
message: 'Cleared 1 pending growth item(s) for u/grower',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('subreddit list', () => {
|
||||
it('adds a community and returns 201', async () => {
|
||||
const { status, json } = await call(app, 'POST', `/api/growth/${ENCODED}/subreddits`, {
|
||||
|
||||
Reference in new issue
Block a user