@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 CHANGED
@@ -1,7 +1,8 @@
1
1
  ## Change Log
2
2
 
3
- #### 3.23.5
3
+ #### 3.23.6
4
4
 
5
+ - fix execCount not being calculated correctly
5
6
  - handle syncJobs being called multiple times
6
7
  - fix abstract job scheduler & job model
7
8
  - remove jobId fallback and update schedule job logic
@@ -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 allPersistedAtJobs = await this.jobRepo.getJobs({ _neq: { disabled: true, at: undefined } });
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clairejs/server",
3
- "version": "3.23.5",
3
+ "version": "3.23.6",
4
4
  "description": "Claire server NodeJs framework written in Typescript.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",