Skip to content

Commit

Permalink
perf(retry): compare prev state instead of regex expression (#2099)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Jul 26, 2023
1 parent f43ea5e commit c141283
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
41 changes: 41 additions & 0 deletions docs/gitbook/bullmq-pro/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,44 @@
## [6.2.2](https://github.com/taskforcesh/bullmq-pro/compare/v6.2.1...v6.2.2) (2023-07-26)


### Bug Fixes

* **deps:** upgrade bullmq to 4.6.0 ([#167](https://github.com/taskforcesh/bullmq-pro/issues/167)) ([9cf92a6](https://github.com/taskforcesh/bullmq-pro/commit/9cf92a62dc3f1e9316bd4559fde4700ff4d9b12c))

## [6.2.1](https://github.com/taskforcesh/bullmq-pro/compare/v6.2.0...v6.2.1) (2023-07-25)


### Bug Fixes

* **flow:** emit delayed event when parent is moved to delayed ([#166](https://github.com/taskforcesh/bullmq-pro/issues/166)) ([38afe1c](https://github.com/taskforcesh/bullmq-pro/commit/38afe1cf3187ddee33d33a39438587d921b8743a))

# [6.2.0](https://github.com/taskforcesh/bullmq-pro/compare/v6.1.1...v6.2.0) (2023-07-25)


### Features

* **groups:** support local priorities ([#156](https://github.com/taskforcesh/bullmq-pro/issues/156)) ([260bd24](https://github.com/taskforcesh/bullmq-pro/commit/260bd24a76d703ec87385c05cdd3b4589f142aa8)), closes [taskforcesh/bullmq-pro-support#23](https://github.com/taskforcesh/bullmq-pro-support/issues/23) [taskforcesh/bullmq-pro-support#13](https://github.com/taskforcesh/bullmq-pro-support/issues/13)

## [6.1.1](https://github.com/taskforcesh/bullmq-pro/compare/v6.1.0...v6.1.1) (2023-07-18)


### Bug Fixes

* add missing error export ([2b8c51f](https://github.com/taskforcesh/bullmq-pro/commit/2b8c51fd43c538fd3eed122ab96d55325da97b90))

# [6.1.0](https://github.com/taskforcesh/bullmq-pro/compare/v6.0.5...v6.1.0) (2023-07-18)


### Bug Fixes

* fix the GroupMaxSizeExceededError prototype ([a1b6a96](https://github.com/taskforcesh/bullmq-pro/commit/a1b6a96f1a0b632940177a1057a4995d59957964))


### Features

* add getGroupStatus ([3bac19d](https://github.com/taskforcesh/bullmq-pro/commit/3bac19d32e9a620a393736152844973951e45d47))
* add support max sized groups ([7bc654c](https://github.com/taskforcesh/bullmq-pro/commit/7bc654c2191c9a2e8c80f4e0843c4beda7d61565))

## [6.0.5](https://github.com/taskforcesh/bullmq-pro/compare/v6.0.4...v6.0.5) (2023-07-11)


Expand Down
6 changes: 3 additions & 3 deletions src/classes/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export class Scripts {
]);
}

protected retryJobsArgs(
protected moveJobsToWaitArgs(
state: FinishedStatus | 'delayed',
count: number,
timestamp: number,
Expand All @@ -776,15 +776,15 @@ export class Scripts {
): Promise<number> {
const client = await this.queue.client;

const args = this.retryJobsArgs(state, count, timestamp);
const args = this.moveJobsToWaitArgs(state, count, timestamp);

return (<any>client).moveJobsToWait(args);
}

async promoteJobs(count = 1000): Promise<number> {
const client = await this.queue.client;

const args = this.retryJobsArgs('delayed', count, Number.MAX_VALUE);
const args = this.moveJobsToWaitArgs('delayed', count, Number.MAX_VALUE);

return (<any>client).moveJobsToWait(args);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/moveJobsToWait-6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ local target = getTargetQueueList(metaKey, KEYS[4], KEYS[5])
local jobs = rcall('ZRANGEBYSCORE', KEYS[3], 0, timestamp, 'LIMIT', 0, maxCount)
if (#jobs > 0) then

if KEYS[3]:match("failed$") then
if ARGV[3] == "failed" then
for i, key in ipairs(jobs) do
local jobKey = KEYS[1] .. key
rcall("HDEL", jobKey, "finishedOn", "processedOn", "failedReason")
end
elseif KEYS[3]:match("completed$") then
elseif ARGV[3] == "completed" then
for i, key in ipairs(jobs) do
local jobKey = KEYS[1] .. key
rcall("HDEL", jobKey, "finishedOn", "processedOn", "returnvalue")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/moveToFinished-13.lua
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
if rcall("SREM", dependenciesSet, jobIdKey) == 1 then
moveParentToWaitIfNeeded(parentQueueKey, dependenciesSet,
parentKey, parentId, timestamp)
end
end
end
end
end
Expand Down

0 comments on commit c141283

Please sign in to comment.