File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -837,14 +837,15 @@ describe('Job', () => {
837
837
} ) ;
838
838
839
839
it ( 'runs a one-time job after its lock expires' , async ( ) => {
840
- let runCount = 0 ;
840
+ const processorPromise = new Promise ( resolve => {
841
+ let runCount = 0 ;
841
842
842
- const processorPromise = new Promise ( resolve =>
843
843
agenda . define (
844
844
'lock job' ,
845
845
async _job => {
846
846
runCount ++ ;
847
847
if ( runCount === 1 ) {
848
+ // this should time out
848
849
await new Promise ( longResolve => setTimeout ( longResolve , 1000 ) ) ;
849
850
} else {
850
851
resolve ( runCount ) ;
@@ -853,14 +854,14 @@ describe('Job', () => {
853
854
{
854
855
lockLifetime : 50
855
856
}
856
- )
857
- ) ;
857
+ ) ;
858
+ } ) ;
858
859
859
860
let errorHasBeenThrown ;
860
861
agenda . on ( 'error' , err => {
861
862
errorHasBeenThrown = err ;
862
863
} ) ;
863
- agenda . processEvery ( 50 ) ;
864
+ agenda . processEvery ( 25 ) ;
864
865
await agenda . start ( ) ;
865
866
agenda . now ( 'lock job' , {
866
867
i : 1
You can’t perform that action at this time.
0 commit comments