Skip to content

Commit 5097b1d

Browse files
committed
update docs
1 parent ec977c6 commit 5097b1d

2 files changed

Lines changed: 58 additions & 12 deletions

File tree

‎History.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
* Ensure event subscription before job save. Closes #179
1111
* Fix Queue singleton
1212
* Fix failed event being called in first attempt. Closes #142
13-
* Disabled search by default (Search index memory leaks). See #58 & #218
13+
* Disable search (Search index memory leaks). See #58 & #218
1414
* Emit error events on both kue and job
15+
* JS/Coffeescript tests added (Mocha+Should)
16+
* Travis support added
17+
1518

1619
0.6.2 / 2013-04-03
1720
==================

‎Readme.md‎

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@
1010

1111
## Features
1212

13-
- delayed jobs
14-
- job event and progress pubsub
15-
- rich integrated UI
16-
- infinite scrolling
13+
- Delayed jobs
14+
- Job event and progress pubsub
15+
- Rich integrated UI
16+
- Infinite scrolling
1717
- UI progress indication
18-
- job specific logging
19-
- powered by Redis
20-
- optional retries
21-
- full-text search capabilities
18+
- Job specific logging
19+
- Powered by Redis
20+
- Optional retries
21+
- Full-text search capabilities
2222
- RESTful JSON API
23+
- Graceful workers shutdown
2324

2425
## Overview
2526

@@ -34,6 +35,7 @@
3435
- [Processing Jobs](#processing-jobs)
3536
- [Processing Concurrency](#processing-concurrency)
3637
- [Updating Progress](#updating-progress)
38+
- [Graceful Shutdown](#graceful-shutdown)
3739
- [Redis Connection Settings](#redis-connection-settings)
3840
- [User-Interface](#user-interface)
3941
- [JSON API](#json-api)
@@ -119,7 +121,8 @@ job.progress(frames, totalFrames);
119121

120122
Job-specific events are fired on the `Job` instances via Redis pubsub. The following events are currently supported:
121123

122-
- `failed` the job has failed
124+
- `failed` the job has failed and has no remaining attempts
125+
- 'failed attempt' the job has failed, but has remaining attempts yet
123126
- `complete` the job has completed
124127
- `promotion` the job (when delayed) is now queued
125128
- `progress` the job's progress ranging from 0-100
@@ -174,7 +177,7 @@ var email = jobs.create('email', {
174177
.save();
175178
```
176179

177-
When using delayed jobs, we must also check the delayed jobs with a timer, promoting them if the scheduled delay has been exceeded. This `setInterval` is defined within `Queue#promote(ms)`, defaulting to a check every 5 seconds.
180+
When using delayed jobs, we must also check the delayed jobs with a timer, promoting them if the scheduled delay has been exceeded. This `setInterval` is defined within `Queue#promote(ms,limit)`, defaulting to a check of top 200 jobs every 5 seconds.
178181

179182
```js
180183
jobs.promote();
@@ -239,9 +242,40 @@ jobs.process('slideshow pdf', 5, function(job, done){
239242
});
240243
```
241244

245+
### Graceful Shutdown
246+
247+
As of Kue 0.7.0, a `Queue#shutdown(fn, timeout)` is added which signals all workers to stop processing after
248+
their current active job is done. Workers will wait `timeout` milliseconds for their active job's done to be called
249+
or mark the active job `failed` with shutdown error reason. When all workers tell Kue they are stopped `fn` is called.
250+
251+
```javascript
252+
process.once( 'SIGTERM', function ( sig ) {
253+
queue.shutdown(function(err) {
254+
console.log( 'Kue is shut down.', err||'' );
255+
process.exit( 0 );
256+
}, 5000 );
257+
});
258+
```
259+
242260
## Redis Connection Settings
243261

244-
By default, Kue will connect to Redis using the client default settings (port defaults to `6379`, host defaults to `127.0.0.1`). Redis client connection settings can be set by overriding the `kue.redis.createClient` function.
262+
By default, Kue will connect to Redis using the client default settings (port defaults to `6379`, host defaults to `127.0.0.1`).
263+
`Queue#createQueue(options)` accepts redis connection options in `options.redis` key.
264+
265+
```javascript
266+
var kue = require('kue');
267+
q = kue.createQueue({
268+
redis: {
269+
port: 1234,
270+
host: '10.0.50.20'
271+
options: {
272+
// look for more redis options in [node_redis](https://github.com/mranney/node_redis)
273+
}
274+
}
275+
});
276+
```
277+
278+
For backward compatibility to `Kue < 0.7.0`, monkey-patch-styled Redis client connection settings can be set by overriding the `kue.redis.createClient` function.
245279

246280
For example, to create a Redis client that connects to `192.168.1.2` on port `1234` that requires authentication, use the following:
247281

@@ -283,6 +317,15 @@ kue.app.set('title', 'My Application');
283317

284318
```js
285319
["5", "7", "10"]
320+
```
321+
You may disable search indexes in `Kue >= 0.7.0` for memory optimization or to avoid probable
322+
memory leak reported in issue list:
323+
324+
```javascript
325+
var kue = require('kue');
326+
q = kue.createQueue({
327+
disableSearch: true
328+
});
286329
```
287330

288331
### GET /stats

0 commit comments

Comments
 (0)