We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents eb0a4d8 + 862b40c commit b6c9112Copy full SHA for b6c9112
src/taskSchema.js
@@ -175,9 +175,19 @@ taskSchema.statics.expireTimedOutTasks = async function expireTimedOutTasks() {
175
}
176
177
if (task.retryOnTimeoutCount > 0) {
178
+ // Copy task data but remove _id so MongoDB generates a new one
179
+ const taskData = task.toObject({ virtuals: false });
180
+ delete taskData._id;
181
await Task.create({
- ...task.toObject({ virtuals: false }),
182
+ ...taskData,
183
status: 'pending',
184
+ retryOnTimeoutCount: task.retryOnTimeoutCount - 1,
185
+ startedRunningAt: null,
186
+ finishedRunningAt: null,
187
+ workerName: null,
188
+ error: null,
189
+ result: null,
190
+ timeoutAt: null,
191
schedulingTimeoutAt: now.valueOf() + 10 * 60 * 1000
192
});
193
} else {
0 commit comments