File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -441,9 +441,15 @@ export class JobProcessor {
441
441
442
442
// check if the job is still alive
443
443
const checkIfJobIsStillAlive = ( ) => {
444
- // check every "this.agenda.definitions[job.attrs.name].lockLifetime"" (or at mininum every processEvery)
444
+ // check every "this.agenda.definitions[job.attrs.name].lockLifetime / 2 "" (or at mininum every processEvery)
445
445
return new Promise ( ( resolve , reject ) =>
446
446
setTimeout ( ( ) => {
447
+ // when job is not running anymore, just finish
448
+ if ( ! job . isRunning ( ) ) {
449
+ resolve ( ) ;
450
+ return ;
451
+ }
452
+
447
453
if ( job . isDead ( ) ) {
448
454
reject (
449
455
new Error (
@@ -454,13 +460,9 @@ export class JobProcessor {
454
460
) ;
455
461
return ;
456
462
}
457
- // when job is not running anymore, just finish
458
- if ( ! job . isRunning ( ) ) {
459
- resolve ( ) ;
460
- return ;
461
- }
463
+
462
464
resolve ( checkIfJobIsStillAlive ( ) ) ;
463
- } , Math . max ( this . processEvery , this . agenda . definitions [ job . attrs . name ] . lockLifetime ) )
465
+ } , Math . max ( this . processEvery , this . agenda . definitions [ job . attrs . name ] . lockLifetime / 2 ) )
464
466
) ;
465
467
} ;
466
468
You can’t perform that action at this time.
0 commit comments