mongo-job-scheduler 0.1.12 → 0.1.13

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.
@@ -150,6 +150,9 @@ class InMemoryJobStore {
150
150
  if (updates.status !== undefined) {
151
151
  job.status = updates.status;
152
152
  }
153
+ if (updates.attempts !== undefined) {
154
+ job.attempts = updates.attempts;
155
+ }
153
156
  job.updatedAt = new Date();
154
157
  }
155
158
  async findAll(query) {
@@ -70,4 +70,5 @@ export interface JobUpdates {
70
70
  retry?: RetryOptions;
71
71
  repeat?: RepeatOptions;
72
72
  status?: JobStatus;
73
+ attempts?: number;
73
74
  }
@@ -212,6 +212,8 @@ class MongoJobStore {
212
212
  $set.repeat = updates.repeat;
213
213
  if (updates.status !== undefined)
214
214
  $set.status = updates.status;
215
+ if (updates.attempts !== undefined)
216
+ $set.attempts = updates.attempts;
215
217
  await this.collection.updateOne({ _id: id }, { $set });
216
218
  }
217
219
  async findAll(query) {
@@ -142,6 +142,7 @@ class Worker {
142
142
  });
143
143
  }
144
144
  else {
145
+ await this.store.update(job._id, { attempts });
145
146
  await this.store.markFailed(job._id, error.message);
146
147
  this.emitter.emitSafe("job:fail", { job, error });
147
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongo-job-scheduler",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Production-grade MongoDB-backed job scheduler with retries, cron, timezone support, and crash recovery",
5
5
  "license": "MIT",
6
6
  "author": "Darshan Bhut",
@@ -40,7 +40,7 @@
40
40
  "scheduler"
41
41
  ],
42
42
  "scripts": {
43
- "build": "tsc",
43
+ "build": "tsc -p tsconfig.build.json",
44
44
  "test": "jest",
45
45
  "test:mongo": "jest tests/mongo",
46
46
  "test:stress": "jest tests/stress",