File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -361,18 +361,18 @@ class ProcessJob extends J.IPCJob {
361
361
}
362
362
363
363
// load next batch
364
- let msgs = await this . loader . load ( this . _id , date , BATCH ) ,
365
- ids = msgs . map ( m => m . n . toString ( ) ) ;
366
-
367
- // reload notes for msgs
368
- ids = ids . filter ( ( id , i ) => ids . indexOf ( id ) === i ) ;
369
- notes = await this . loader . notes ( ids ) ;
364
+ let msgs = await this . loader . load ( this . _id , date , BATCH ) ;
370
365
371
366
// no messages left, break from the loop
372
367
if ( ! msgs . length ) {
373
368
break ;
374
369
}
375
370
371
+ // reload notes for msgs
372
+ let ids = msgs . map ( m => m . n . toString ( ) ) ;
373
+ ids = ids . filter ( ( id , i ) => ids . indexOf ( id ) === i ) ;
374
+ notes = await this . loader . notes ( ids ) ;
375
+
376
376
// mark messages as being sent
377
377
await Promise . all ( Object . values ( notes ) . map ( json => this . loader . updateNote ( json . _id , { $addToSet : { jobs : this . _id } , $bit : { 'result.status' : { or : N . Status . Sending } } } ) ) ) ;
378
378
Object . values ( notes ) . map ( n => n . _id . toString ( ) ) . forEach ( id => sending . add ( id ) ) ;
You can’t perform that action at this time.
0 commit comments