@joystick.js/node-canary 0.0.0-canary.292 → 0.0.0-canary.294

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.
@@ -127,15 +127,12 @@ class Queue {
127
127
  ...nextJob,
128
128
  queue: this,
129
129
  completed: () => this._handleJobCompleted(nextJob?._id),
130
- failed: (error) => this._handleJobFailed(nextJob?._id, error),
130
+ failed: (error) => this._handleJobFailed(nextJob, job_definition, error),
131
131
  delete: () => this._handleDeleteJob(nextJob?._id),
132
132
  requeue: (nextRunAt = "") => this._handleRequeueJob(nextJob, nextRunAt)
133
133
  });
134
134
  } catch (exception) {
135
- this._handleJobFailed(nextJob?._id, exception);
136
- if (job_definition?.requeueOnFailure) {
137
- this._handleRequeueJob(nextJob?.nextRunAt, dayjs().add(10, "seconds").format());
138
- }
135
+ this._handleJobFailed(nextJob, job_definition, exception);
139
136
  }
140
137
  }
141
138
  }
@@ -145,8 +142,11 @@ class Queue {
145
142
  _handleJobCompleted(jobId = "") {
146
143
  return this.db.setJobCompleted(jobId);
147
144
  }
148
- _handleJobFailed(jobId = "", error = "") {
149
- return this.db.setJobFailed(jobId, error);
145
+ _handleJobFailed(nextJob = {}, job_definition = {}, error = "") {
146
+ if (job_definition?.requeueOnFailure) {
147
+ return this._handleRequeueJob(nextJob?._id, timestamps.get_future_time("seconds", 10));
148
+ }
149
+ return this.db.setJobFailed(nextJob?._id, error);
150
150
  }
151
151
  _handleDeleteJob(jobId = "") {
152
152
  return this.db.deleteJob(jobId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joystick.js/node-canary",
3
- "version": "0.0.0-canary.292",
3
+ "version": "0.0.0-canary.294",
4
4
  "type": "module",
5
5
  "description": "A Node.js framework for building web apps.",
6
6
  "main": "./dist/index.js",