From ce00ebb95ffbdee70166121d11e026f40bcf4a2e Mon Sep 17 00:00:00 2001 From: fgozdz Date: Thu, 28 Nov 2024 13:17:54 +0100 Subject: [PATCH] fix(docs): add processor in the worker --- docs/gitbook/guide/connections.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/gitbook/guide/connections.md b/docs/gitbook/guide/connections.md index 8de81e8e11..7d50645cfa 100644 --- a/docs/gitbook/guide/connections.md +++ b/docs/gitbook/guide/connections.md @@ -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`.