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
// you may want to fetch each id to get the Job object out of it...
434
+
});
435
+
```
436
+
437
+
however the second one doesn't scale to large deployments, there you can use more specific `Job` static methods:
438
+
439
+
```js
440
+
kue.Job.rangeByState( 'failed', 0, n, 'asc', function( err, jobs ) {
441
+
// you have an array of maximum n Job objects here
442
+
});
443
+
```
444
+
or
445
+
446
+
```js
447
+
kue.Job.rangeByType( 'my-job-type', 'failed', 0, n, 'asc', function( err, jobs ) {
448
+
// you have an array of maximum n Job objects here
449
+
});
450
+
```
451
+
452
+
**Note***that the last two methods are subject to change in later Kue versions.*
453
+
454
+
409
455
### Programmatic Job Management
410
456
411
-
If you did none of above or your process lost active jobs in any way, you can recover from them when your process is restarted. A blind logic would be to re-queue all stuck jobs:
457
+
If you did none of above in [Error Handling](#error-handling) section or your process lost active jobs in any way, you can recover from them when your process is restarted. A blind logic would be to re-queue all stuck jobs:
412
458
413
459
```js
414
460
queue.active( function( err, ids ) {
415
461
ids.forEach( function( id ) {
416
462
kue.Job.get( id, function( err, job ) {
417
-
// if job is a stuck one
463
+
//Your application should check if job is a stuck one
0 commit comments