From e2261b63e9053fb5116dd0ef393f464bf16da190 Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Thu, 22 Jun 2023 08:56:40 +0200 Subject: [PATCH 1/2] fix: clear queue endpoint error with redis script (#11037) Error message: ``` ReplyError: ERR value is not an integer or out of range script: 720d973b3877f92b4fb3285ced83c97cdd204979, on @user_script:209. ``` The whole error can be tracked back to one of the arguments, which is `Infinity` in the codebase, but it has to be a number. The documentation in bullmq says `0` is unlimited[^1], and bullmq tries to parse the argument with `tonumber` which returns with `-9223372036854775808` if the argument is `"Infinity"` which is out of bound. ``` 127.0.0.1:6379> eval 'return tonumber(ARGV[3])' '2' 'slippy.xyz:queue:inbox:inbox:delayed' 'slippy.xyz:queue:inbox:inbox:events' 'slippy.xyz:queue:inbox:inbox:' '1687183763944' Infinity 'delayed' (integer) -9223372036854775808 127.0.0.1:6379> ``` [^1]: https://github.com/taskforcesh/bullmq/blob/master/src/commands/cleanJobsInSet-2.lua#L10 Signed-off-by: Efertone --- packages/backend/src/core/QueueService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/QueueService.ts b/packages/backend/src/core/QueueService.ts index 2ae8a2b75..5b7359074 100644 --- a/packages/backend/src/core/QueueService.ts +++ b/packages/backend/src/core/QueueService.ts @@ -400,11 +400,11 @@ export class QueueService { this.deliverQueue.once('cleaned', (jobs, status) => { //deliverLogger.succ(`Cleaned ${jobs.length} ${status} jobs`); }); - this.deliverQueue.clean(0, Infinity, 'delayed'); + this.deliverQueue.clean(0, 0, 'delayed'); this.inboxQueue.once('cleaned', (jobs, status) => { //inboxLogger.succ(`Cleaned ${jobs.length} ${status} jobs`); }); - this.inboxQueue.clean(0, Infinity, 'delayed'); + this.inboxQueue.clean(0, 0, 'delayed'); } } From e8c5117b2dfc60641c26ff972917c8cd94731040 Mon Sep 17 00:00:00 2001 From: Caipira Date: Fri, 23 Jun 2023 16:30:47 +0900 Subject: [PATCH 2/2] fix(backend): Resolve missing parseObjectId in IdService (#11039) --- packages/backend/src/core/IdService.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/core/IdService.ts b/packages/backend/src/core/IdService.ts index 8aa6ccfc4..60098bc81 100644 --- a/packages/backend/src/core/IdService.ts +++ b/packages/backend/src/core/IdService.ts @@ -5,7 +5,7 @@ import type { Config } from '@/config.js'; import { genAid, parseAid } from '@/misc/id/aid.js'; import { genMeid, parseMeid } from '@/misc/id/meid.js'; import { genMeidg, parseMeidg } from '@/misc/id/meidg.js'; -import { genObjectId } from '@/misc/id/object-id.js'; +import { genObjectId, parseObjectId } from '@/misc/id/object-id.js'; import { bindThis } from '@/decorators.js'; import { parseUlid } from '@/misc/id/ulid.js'; @@ -38,7 +38,7 @@ export class IdService { public parse(id: string): { date: Date; } { switch (this.method) { case 'aid': return parseAid(id); - case 'objectid': + case 'objectid': return parseObjectId(id); case 'meid': return parseMeid(id); case 'meidg': return parseMeidg(id); case 'ulid': return parseUlid(id);