@clairejs/server 3.28.3 → 3.28.4

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,6 +1,6 @@
1
1
  ## Change Log
2
2
 
3
- #### 3.28.3
3
+ #### 3.28.4
4
4
 
5
5
  - implement new job scheduler
6
6
 
@@ -84,18 +84,18 @@ export class AbstractJobScheduler {
84
84
  update.lastError = String(err);
85
85
  //-- job run error, check retry
86
86
  const maxRetry = job.maxRetry || 0;
87
+ let retry = false;
87
88
  if (maxRetry) {
88
89
  const currentRetryCount = job.retryCount || 0;
89
- if (currentRetryCount < maxRetry) {
90
+ retry = currentRetryCount < maxRetry;
91
+ if (retry) {
90
92
  await this.retryJob(job, Date.now() + Math.max(job.retryDelayMs || 0, 60000));
91
93
  update.retryCount = currentRetryCount + 1;
92
94
  }
93
- else {
94
- if (job.at) {
95
- update.disabled = true;
96
- await this.cancelJob(job.id);
97
- }
98
- }
95
+ }
96
+ if (!retry && job.at) {
97
+ update.disabled = true;
98
+ await this.cancelJob(job.id);
99
99
  }
100
100
  }
101
101
  await this.jobRepo.updateJobById(job.id, update, tx);
@@ -88,7 +88,7 @@ let AwsJobScheduler = class AwsJobScheduler extends AbstractJobScheduler {
88
88
  }
89
89
  else {
90
90
  //-- schedule a new one-time job to re-execute this cron with minus one maxRetry
91
- await this.scheduleJob({ ...payload, at, maxRetry: (payload.maxRetry || 0) - 1 });
91
+ await this.scheduleJob({ ...payload, cron: undefined, at, maxRetry: (payload.maxRetry || 0) - 1 });
92
92
  }
93
93
  }
94
94
  async cleanupJob(jobId) {
@@ -154,7 +154,7 @@ let LocalJobScheduler = class LocalJobScheduler extends AbstractJobScheduler {
154
154
  }
155
155
  else {
156
156
  //-- schedule a new one-time job to re-execute this cron with minus one maxRetry
157
- await this.scheduleJob({ ...payload, at, maxRetry: (job.maxRetry || 0) - 1 });
157
+ await this.scheduleJob({ ...payload, cron: undefined, at, maxRetry: (job.maxRetry || 0) - 1 });
158
158
  }
159
159
  }
160
160
  async cleanupJob(jobId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clairejs/server",
3
- "version": "3.28.3",
3
+ "version": "3.28.4",
4
4
  "description": "Claire server NodeJs framework written in Typescript.",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",