Skip to content

Commit a458aea

Browse files
committed
fix: only unlock jobs with a next run at date on shutdown
1 parent 12ff7e7 commit a458aea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/JobDbRepository.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ export class JobDbRepository {
8484
* Internal method to unlock jobs so that they can be re-run
8585
*/
8686
async unlockJobs(jobIds: ObjectId[]): Promise<void> {
87-
await this.collection.updateMany({ _id: { $in: jobIds } }, { $unset: { lockedAt: true } });
87+
await this.collection.updateMany(
88+
{ _id: { $in: jobIds }, nextRunAt: { $ne: null } },
89+
{ $unset: { lockedAt: true } }
90+
);
8891
}
8992

9093
async lockJob(job: JobWithId): Promise<IJobParameters | undefined> {

0 commit comments

Comments
 (0)