You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// NOTE: considered doing `this.receivedJobs(jobsToReturn)`; but I
481
+
// NOTE: considered doing `this.receivedJobs(jobsToReturn)`; but
481
482
// simply trying to release them again seems safer and more correct.
482
483
default: {
483
-
if(attempts<maxAttempts){
484
+
if(attempts>=maxAttempts){
485
+
this.onMajorError(
486
+
newError(
487
+
`Error occurred whilst returning jobs from local queue to database queue; raising major error after ${attempts} (>= ${maxAttempts}) attempts (should trigger shutdown). Initial error: ${initialError.message}`,
488
+
{cause: initialError},
489
+
),
490
+
);
491
+
}
492
+
{
484
493
constcode=lastError?.codeasstring;
485
494
constretryable=RETRYABLE_ERROR_CODES[code];
486
495
constdelay=calculateDelay(attempts-1,{
@@ -499,15 +508,6 @@ export class LocalQueue {
499
508
jobsToReturn,
500
509
).then(noop,onError),
501
510
);
502
-
}else{
503
-
// TODO: is this the correct way to handle this? Are we allowed to
504
-
// trigger shut down internally?
505
-
this.release();
506
-
// Now we're in release mode, throwing the error will be tracked
507
-
// automatically by `this.background()`
508
-
thrownewError(
509
-
`Error occurred whilst returning jobs from local queue to database queue; aborting after ${attempts} attempts. Initial error: ${initialError.message}`,
0 commit comments