From e1e0281d297e6bea525b4ee959a0ff2356e23506 Mon Sep 17 00:00:00 2001 From: Manuel Astudillo Date: Thu, 25 Apr 2024 23:00:32 +0200 Subject: [PATCH 1/2] fix(worker): force timeout on bzpopmin command --- src/classes/worker.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/classes/worker.ts b/src/classes/worker.ts index 431f6c288c..6c7fe1342d 100644 --- a/src/classes/worker.ts +++ b/src/classes/worker.ts @@ -625,9 +625,18 @@ export class Worker< // reference: https://github.com/taskforcesh/bullmq/issues/1658 blockTimeout = Math.min(blockTimeout, maximumBlockTimeout); + // We cannot trust that the blocking connection stays blocking forever + // due to issues in Redis and IORedis, so we will reconnect if we + // don't get a response in the expected time. + const timeout = setTimeout(async () => { + await this.blockingConnection.disconnect(); + await this.blockingConnection.reconnect(); + }, blockTimeout * 1000 + 1000); + // Markers should only be used for un-blocking, so we will handle them in this // function only. const result = await bclient.bzpopmin(this.keys.marker, blockTimeout); + clearTimeout(timeout); if (result) { const [_key, member, score] = result; From a7fa029e43cdcab7a7ccc027da5e6c3603af7538 Mon Sep 17 00:00:00 2001 From: Manuel Astudillo Date: Thu, 25 Apr 2024 23:03:56 +0200 Subject: [PATCH 2/2] chore: upgrade ioredis to v5.4.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 3625fa59b2..eedd9ba7dd 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "dependencies": { "cron-parser": "^4.6.0", - "ioredis": "^5.3.2", + "ioredis": "^5.4.1", "msgpackr": "^1.10.1", "node-abort-controller": "^3.1.1", "semver": "^7.5.4", diff --git a/yarn.lock b/yarn.lock index 790bd9eeff..92ca3c7294 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3910,10 +3910,10 @@ into-stream@^6.0.0: from2 "^2.3.0" p-is-promise "^3.0.0" -ioredis@^5.3.2: - version "5.3.2" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.3.2.tgz#9139f596f62fc9c72d873353ac5395bcf05709f7" - integrity sha512-1DKMMzlIHM02eBBVOFQ1+AolGjs6+xEcM4PDL7NqOS6szq7H9jSaEkIUH6/a5Hl241LzW6JLSiAbNvTQjUupUA== +ioredis@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" + integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA== dependencies: "@ioredis/commands" "^1.1.1" cluster-key-slot "^1.1.0"