Skip to content

Commit

Permalink
Document importance of using Kue error listeners, Closes #409
Browse files Browse the repository at this point in the history
  • Loading branch information
behrad committed Mar 22, 2015
1 parent 4a406ad commit 273d612
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Add an extra parameter to the progress method to notify extra contextual data, Closes #466, Closes #427, Closes #313
* Document job event callback arguments, Closes #542
* Fix typo in documentation, Closes #506
* Document importance of using Kue `error` listeners, Closes #409


0.8.11 / 2014-12-15
Expand Down
12 changes: 12 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,18 @@ jobs.process('slideshow pdf', 5, function(job, done){
});
```

### Error Handling

All errors either in Queue or Workers are emitted to Queue object. You should bind to `error` events to prevent uncaught exceptions or debug your code.

```javascript
var queue = require('kue').createQueue();

queue.on( 'error', function( err ) {
console.log( 'Oops... ', err );
});
```

### Graceful Shutdown

As of Kue 0.7.0, a `Queue#shutdown(fn, timeout)` is added which signals all workers to stop processing after their current active job is done. Workers will wait `timeout` milliseconds for their active job's done to be called or mark the active job `failed` with shutdown error reason. When all workers tell Kue they are stopped `fn` is called.
Expand Down

0 comments on commit 273d612

Please sign in to comment.