@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.
- package/dist/app/queues/index.js +7 -7
- package/package.json +1 -1
package/dist/app/queues/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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(
|
|
149
|
-
|
|
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);
|