feat: add reusable jobqueue library

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-05-16 00:51:54 +02:00
commit 34ca0fe17d
30 changed files with 6405 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
import { RetentionScheduler } from '../src/index.js';
describe('RetentionScheduler', () => {
it('runs stale and delete handlers', async () => {
const calls: string[] = [];
const scheduler = new RetentionScheduler(
{
staleAfterMs: 1_000,
deleteAfterMs: 2_000,
},
{
markStale: async () => {
calls.push('stale');
return [];
},
deleteStale: async () => {
calls.push('delete');
return [];
},
},
);
await scheduler.runCycle();
scheduler.stop();
expect(calls).toEqual(['stale', 'delete']);
});
});