Skip to content

Commit

Permalink
fix(docs): add processor in the worker
Browse files Browse the repository at this point in the history
  • Loading branch information
fgozdz committed Nov 28, 2024
1 parent a2f9192 commit ce00ebb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/gitbook/guide/connections.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ import IORedis from 'ioredis';
const connection = new IORedis({ maxRetriesPerRequest: null });

// Reuse the ioredis instance in 2 different consumers
const myFirstWorker = new Worker('myFirstWorker', { connection });
const mySecondWorker = new Worker('mySecondWorker', { connection });
const myFirstWorker = new Worker('myFirstWorker', async job => {}, {
connection,
});
const mySecondWorker = new Worker('mySecondWorker', async job => {}, {
connection,
});
```

Note that in the third example, even though the ioredis instance is being reused, the worker will create a duplicated connection that it needs internally to make blocking connections. Consult the [ioredis](https://github.com/luin/ioredis/blob/master/API.md) documentation to learn how to properly create an instance of `IORedis`.
Expand Down

0 comments on commit ce00ebb

Please sign in to comment.