fix(#707): scope session GC retention
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Jarvis
2026-07-12 15:57:09 -05:00
parent ca9c2b5c23
commit 5ad29926d9
9 changed files with 100 additions and 174 deletions

View File

@@ -162,6 +162,23 @@ export class QueueService implements OnModuleInit, OnModuleDestroy {
);
}
/**
* Remove every existing repeatable schedule for a job name. This supports
* safe retirement of previously registered system-wide jobs.
*/
async removeRepeatableJobs(queueName: string, jobName: string): Promise<number> {
const queue = this.getQueue(queueName);
const jobs = await queue.getRepeatableJobs();
const matchingJobs = jobs.filter((job) => job.name === jobName);
await Promise.all(matchingJobs.map((job) => queue.removeRepeatableByKey(job.key)));
if (matchingJobs.length > 0) {
this.logger.log(
`Removed ${matchingJobs.length} repeatable "${jobName}" job(s) from "${queueName}"`,
);
}
return matchingJobs.length;
}
/**
* Register a Worker for the given queue name with error handling and
* exponential backoff.