diff --git a/docs/gitbook/bullmq-pro/changelog.md b/docs/gitbook/bullmq-pro/changelog.md index ea11b6dc40..237925bb50 100644 --- a/docs/gitbook/bullmq-pro/changelog.md +++ b/docs/gitbook/bullmq-pro/changelog.md @@ -1,3 +1,18 @@ +## [7.17.2](https://github.com/taskforcesh/bullmq-pro/compare/v7.17.1...v7.17.2) (2024-10-23) + + +### Bug Fixes + +* **repeatable:** export RepeatOptions ([#261](https://github.com/taskforcesh/bullmq-pro/issues/261)) ([b620bdf](https://github.com/taskforcesh/bullmq-pro/commit/b620bdf4f7449ad20f0ffd07786880115ec77fd9)) +* **sandbox:** fix serialization of error with circular references are present ([#2815](https://github.com/taskforcesh/bullmq/issues/2815)) fix [#2813](https://github.com/taskforcesh/bullmq/issues/2813) ([a384d92](https://github.com/taskforcesh/bullmq/commit/a384d926bee15bffa84178a8fad7b94a6a08b572)) + +## [7.17.1](https://github.com/taskforcesh/bullmq-pro/compare/v7.17.0...v7.17.1) (2024-10-18) + + +### Bug Fixes + +* **worker-pro:** use JobPro as part of WorkerProListener events ([#260](https://github.com/taskforcesh/bullmq-pro/issues/260)) ([966ac9c](https://github.com/taskforcesh/bullmq-pro/commit/966ac9cb41088c13a917450814ed9f6b48b79a9b)) + # [7.17.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.16.0...v7.17.0) (2024-10-12) diff --git a/src/commands/includes/moveParentFromWaitingChildrenToFailed.lua b/src/commands/includes/moveParentFromWaitingChildrenToFailed.lua index 6a6b63fbfe..4ad4723506 100644 --- a/src/commands/includes/moveParentFromWaitingChildrenToFailed.lua +++ b/src/commands/includes/moveParentFromWaitingChildrenToFailed.lua @@ -4,7 +4,7 @@ -- Includes --- @include "moveParentToWaitIfNeeded" ---- @include "removeDebounceKeyIfNeeded" +--- @include "removeDeduplicationKeyIfNeeded" local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, parentId, jobIdKey, timestamp) if rcall("ZREM", parentQueueKey .. ":waiting-children", parentId) == 1 then @@ -16,7 +16,7 @@ local function moveParentFromWaitingChildrenToFailed( parentQueueKey, parentKey, local jobAttributes = rcall("HMGET", parentKey, "parent", "deid") - removeDebounceKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2]) + removeDeduplicationKeyIfNeeded(parentQueueKey .. ":", jobAttributes[2]) if jobAttributes[1] then local parentData = cjson.decode(jobAttributes[1]) diff --git a/src/commands/includes/removeDebounceKeyIfNeeded.lua b/src/commands/includes/removeDebounceKeyIfNeeded.lua deleted file mode 100644 index fbc058e20f..0000000000 --- a/src/commands/includes/removeDebounceKeyIfNeeded.lua +++ /dev/null @@ -1,14 +0,0 @@ ---[[ - Function to remove debounce key if needed. -]] - -local function removeDebounceKeyIfNeeded(prefixKey, debounceId) - if debounceId then - local debounceKey = prefixKey .. "de:" .. debounceId - local pttl = rcall("PTTL", debounceKey) - - if pttl == 0 or pttl == -1 then - rcall("DEL", debounceKey) - end - end -end diff --git a/src/commands/includes/removeDeduplicationKeyIfNeeded.lua b/src/commands/includes/removeDeduplicationKeyIfNeeded.lua new file mode 100644 index 0000000000..ff475ae155 --- /dev/null +++ b/src/commands/includes/removeDeduplicationKeyIfNeeded.lua @@ -0,0 +1,14 @@ +--[[ + Function to remove deduplication key if needed. +]] + +local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId) + if deduplicationId then + local deduplicationKey = prefixKey .. "de:" .. deduplicationId + local pttl = rcall("PTTL", deduplicationKey) + + if pttl == 0 or pttl == -1 then + rcall("DEL", deduplicationKey) + end + end +end diff --git a/src/commands/moveStalledJobsToWait-9.lua b/src/commands/moveStalledJobsToWait-9.lua index a882ed0445..0c35adb541 100644 --- a/src/commands/moveStalledJobsToWait-9.lua +++ b/src/commands/moveStalledJobsToWait-9.lua @@ -29,7 +29,7 @@ local rcall = redis.call --- @include "includes/getTargetQueueList" --- @include "includes/moveParentFromWaitingChildrenToFailed" --- @include "includes/moveParentToWaitIfNeeded" ---- @include "includes/removeDebounceKeyIfNeeded" +--- @include "includes/removeDeduplicationKeyIfNeeded" --- @include "includes/removeJob" --- @include "includes/removeJobsByMaxAge" --- @include "includes/removeJobsByMaxCount" @@ -88,7 +88,7 @@ if (#stalling > 0) then local opts = cjson.decode(rawOpts) local removeOnFailType = type(opts["removeOnFail"]) rcall("ZADD", failedKey, timestamp, jobId) - removeDebounceKeyIfNeeded(queueKeyPrefix, jobAttributes[3]) + removeDeduplicationKeyIfNeeded(queueKeyPrefix, jobAttributes[3]) local failedReason = "job stalled more than allowable limit" diff --git a/src/commands/moveToFinished-14.lua b/src/commands/moveToFinished-14.lua index dc396da706..06631b52d9 100644 --- a/src/commands/moveToFinished-14.lua +++ b/src/commands/moveToFinished-14.lua @@ -65,7 +65,7 @@ local rcall = redis.call --- @include "includes/moveParentToWaitIfNeeded" --- @include "includes/prepareJobForProcessing" --- @include "includes/promoteDelayedJobs" ---- @include "includes/removeDebounceKeyIfNeeded" +--- @include "includes/removeDeduplicationKeyIfNeeded" --- @include "includes/removeJobKeys" --- @include "includes/removeJobsByMaxAge" --- @include "includes/removeJobsByMaxCount" @@ -119,7 +119,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists local prefix = ARGV[7] - removeDebounceKeyIfNeeded(prefix, jobAttributes[3]) + removeDeduplicationKeyIfNeeded(prefix, jobAttributes[3]) -- If job has a parent we need to -- 1) remove this job id from parents dependencies diff --git a/tests/test_queue.ts b/tests/test_queue.ts index 23ddf7ffba..dd955ed4c3 100644 --- a/tests/test_queue.ts +++ b/tests/test_queue.ts @@ -1,11 +1,12 @@ import { expect } from 'chai'; import { default as IORedis } from 'ioredis'; import { describe, beforeEach, it, before, after as afterAll } from 'mocha'; +import { after } from 'lodash'; import * as sinon from 'sinon'; import { v4 } from 'uuid'; import { FlowProducer, Job, Queue, Worker } from '../src/classes'; import { delay, removeAllQueueData } from '../src/utils'; -import { after } from 'lodash'; +import { version as currentPackageVersion } from '../src/version'; describe('queues', function () { const redisHost = process.env.REDIS_HOST || 'localhost'; @@ -39,8 +40,7 @@ describe('queues', function () { it('should return the queue version', async () => { const queue = new Queue(queueName, { connection }); const version = await queue.getVersion(); - const { version: pkgJsonVersion, name } = require('../package.json'); - expect(version).to.be.equal(`${name}:${pkgJsonVersion}`); + expect(version).to.be.equal(`bullmq:${currentPackageVersion}`); return queue.close(); });