@clairejs/server 3.23.5 → 3.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/job/AbstractJobScheduler.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,8 +52,11 @@ export class AbstractJobScheduler {
|
|
|
52
52
|
(updatedScheduledCronJobs.some((j) => j.jobName === job.jobName) ||
|
|
53
53
|
!scheduledCronJobs.some((j) => j.jobName === job.jobName)));
|
|
54
54
|
this.logger.debug(`Resync ${resyncCronJobs.length} cron jobs`, resyncCronJobs);
|
|
55
|
+
const allPersistedJobs = await this.jobRepo.getJobs({ _neq: { disabled: true } });
|
|
55
56
|
for (const job of resyncCronJobs) {
|
|
57
|
+
const matchedPersistedJob = allPersistedJobs.find((persistedJob) => persistedJob.jobName === job.jobName && persistedJob.cron === job.cron);
|
|
56
58
|
await this.scheduleJob({
|
|
59
|
+
...matchedPersistedJob,
|
|
57
60
|
...job.retryOptions,
|
|
58
61
|
jobName: job.jobName,
|
|
59
62
|
cron: job.cron,
|
|
@@ -61,8 +64,7 @@ export class AbstractJobScheduler {
|
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
66
|
//-- sync "at" jobs
|
|
64
|
-
const
|
|
65
|
-
const missingScheduledAtJobs = allPersistedAtJobs.filter((job) => !scheduledJobs.find((scheduled) => scheduled.id === job.id));
|
|
67
|
+
const missingScheduledAtJobs = allPersistedJobs.filter((job) => job.at && !scheduledJobs.find((scheduled) => scheduled.id === job.id));
|
|
66
68
|
for (const job of missingScheduledAtJobs) {
|
|
67
69
|
await this.scheduleJob(job);
|
|
68
70
|
}
|
|
@@ -160,6 +162,7 @@ export class AbstractJobScheduler {
|
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
await this.jobRepo.updateJobById(job.id, update, tx);
|
|
165
|
+
Object.assign(job, update);
|
|
163
166
|
}
|
|
164
167
|
await tx.commit();
|
|
165
168
|
}
|