Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: keep jobs in waiting list when queue is paused #2769

Merged
merged 41 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
481b664
refactor: use isQueuePausedOrMaxed instead of getTargetQueueList
roggervalf Sep 12, 2024
2654bb8
chore: consider moving jobs from paused to wait if there are
roggervalf Sep 12, 2024
9286d68
refactor: obliterate to consider removing from wait
roggervalf Sep 13, 2024
1f2f889
refactor: remove paused key from addStandardJob
roggervalf Sep 13, 2024
a66ddba
refactor: remove paused key scripts
roggervalf Sep 13, 2024
87447a8
refactor: remove paused key from other scripts
roggervalf Sep 13, 2024
c3acbb9
refactor: remove paused key on moveToActive
roggervalf Sep 13, 2024
e973ec5
refactor: remove paused key on moveToFinished
roggervalf Sep 13, 2024
65c3beb
chore: fix moveToFinishedKeys ref
roggervalf Sep 13, 2024
7a93835
chore: add repairPausedKey script
roggervalf Sep 14, 2024
0cde0c3
chore: fix merge conflicts
roggervalf Sep 21, 2024
537ce42
docs(migrations): add new section
roggervalf Sep 21, 2024
e593d8a
docs: fix typo
roggervalf Sep 21, 2024
efe1a56
chore: restore few decoded options
roggervalf Sep 24, 2024
42ebfcb
refactor: add executeMigrations script
roggervalf Sep 26, 2024
616e45d
Merge branch 'master' into refactor-paused
roggervalf Sep 26, 2024
a8103c0
docs(flows): add missing word in flows guide (#2788)
armpogart Sep 27, 2024
f5f7426
test: update test cases
roggervalf Sep 27, 2024
db131b4
Merge branch 'master' into refactor-paused
roggervalf Sep 27, 2024
9a3067b
chore: remove only statement
roggervalf Sep 27, 2024
77b81ba
test: fix test cases
roggervalf Sep 28, 2024
47408f3
Merge branch 'v6' into refactor-paused
roggervalf Sep 28, 2024
67e9306
chore: add POC for migrations
manast Sep 30, 2024
fcac031
feat(queue-base): add migrations checker
manast Sep 30, 2024
4cd34a1
refactor(script): consider using rename when no wait jobs
roggervalf Oct 1, 2024
50b0313
fix: return client in get client in all paths
manast Oct 1, 2024
9f97ec0
Merge branch 'refactor-paused' of https://github.com/taskforcesh/bull…
manast Oct 1, 2024
1f7245a
chore: fix merge conflicts
roggervalf Oct 12, 2024
ee33a81
chore: fix merge conflicts
roggervalf Oct 16, 2024
92d9154
chore: add migrations in list
roggervalf Oct 16, 2024
268b9d4
test: fix test cases
roggervalf Oct 16, 2024
6e20049
docs(guide): update migrations for v6
roggervalf Oct 16, 2024
d0c4015
test: waitUntilReady in test cases
roggervalf Oct 16, 2024
fd3ba17
feat: add skipMigrationsExecution option
roggervalf Oct 17, 2024
82da69a
docs: update v6 clarification for skipMigrationsExecution
roggervalf Oct 17, 2024
f1b85ab
docs: address comments about migrations
roggervalf Nov 6, 2024
852b41e
chore: fix merge conflicts
roggervalf Nov 16, 2024
7514be9
feat(queue-base): add runMigrations method
roggervalf Nov 16, 2024
e2e3c9d
Merge branch 'master' into refactor-paused
roggervalf Nov 16, 2024
e370b84
chore: remove extra method
roggervalf Nov 19, 2024
ac13902
chore: fix merge conflicts
roggervalf Nov 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/gitbook/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
- [Producers](guide/nestjs/producers.md)
- [Queue Events Listeners](guide/nestjs/queue-events-listeners.md)
- [Going to production](guide/going-to-production.md)
- [Migration to newer versions](guide/migration-to-newer-versions.md)
- [Migration to newer versions](guide/migrations/migration-to-newer-versions.md)
- [Version 6](guide/migrations/v6.md)
- [Troubleshooting](guide/troubleshooting.md)

## Patterns
Expand Down
62 changes: 56 additions & 6 deletions docs/gitbook/bullmq-pro/changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,58 @@
## [7.20.1](https://github.com/taskforcesh/bullmq-pro/compare/v7.20.0...v7.20.1) (2024-11-10)


### Bug Fixes

* **repeatable:** only apply immediately in the first iteration ([f69cfbc](https://github.com/taskforcesh/bullmq/commit/f69cfbcbc5516a854adbbc29b259d08e65a19705))

# [7.20.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.19.0...v7.20.0) (2024-11-09)


### Bug Fixes

* **scripts:** set package version by default for extension ([#2887](https://github.com/taskforcesh/bullmq/issues/2887)) ([b955340](https://github.com/taskforcesh/bullmq/commit/b955340b940e4c1e330445526cd572e0ab25daa9))
* **worker:** allow retrieving concurrency value ([#2883](https://github.com/taskforcesh/bullmq/issues/2883)) fixes [#2880](https://github.com/taskforcesh/bullmq/issues/2880) ([52f6317](https://github.com/taskforcesh/bullmq/commit/52f6317ecd2080a5c9684a4fe384e20d86f21de4))
* **connection:** set packageVersion as protected attribute for extension ([#2884](https://github.com/taskforcesh/bullmq/issues/2884)) ([411ccae](https://github.com/taskforcesh/bullmq/commit/411ccae9419e008d916be6cf71c4d57dd2a07b2b))


### Features

* **queue-events:** add QueueEventsProducer for publishing custom events ([#2844](https://github.com/taskforcesh/bullmq/issues/2844)) ([5eb03cd](https://github.com/taskforcesh/bullmq/commit/5eb03cd7f27027191eb4bc4ed7386755fd9be1fb))
* **flows:** add telemetry support ([#2879](https://github.com/taskforcesh/bullmq/issues/2879)) ([5ed154b](https://github.com/taskforcesh/bullmq/commit/5ed154ba240dbe9eb5c22e27ad02e851c0f3cf69))

# [7.19.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.18.0...v7.19.0) (2024-11-08)


### Bug Fixes

* **deps:** bump msgpackr to 1.1.2 to resolve ERR_BUFFER_OUT_OF_BOUNDS error ([#2882](https://github.com/taskforcesh/bullmq/issues/2882)) ref [#2747](https://github.com/taskforcesh/bullmq/issues/2747) ([4d2136c](https://github.com/taskforcesh/bullmq/commit/4d2136cc6ba340e511a539c130c9a739fe1055d0))


### Features

* **scheduler:** add getJobScheduler method ([#2877](https://github.com/taskforcesh/bullmq/issues/2877)) ref [#2875](https://github.com/taskforcesh/bullmq/issues/2875) ([956d98c](https://github.com/taskforcesh/bullmq/commit/956d98c6890484742bb080919c70692234f28c69))
* **queue:** add a telemetry interface ([#2721](https://github.com/taskforcesh/bullmq/issues/2721)) ([273b574](https://github.com/taskforcesh/bullmq/commit/273b574e6b5628680990eb02e1930809c9cba5bb))

# [7.18.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.17.2...v7.18.0) (2024-11-07)


### Bug Fixes

* proper way to get version ([b4e25c1](https://github.com/taskforcesh/bullmq/commit/b4e25c13cafc001748ee6eb590133feb8ee24d7b))
* **scripts:** add missing wait in isJobInList ([9ef865c](https://github.com/taskforcesh/bullmq/commit/9ef865c7de6086cb3c906721fd046aeed1e0d27f))
* **redis:** use version for naming loaded lua scripts ([fe73f6d](https://github.com/taskforcesh/bullmq/commit/fe73f6d4d776dc9f99ad3a094e5c59c5fafc96f1))


### Features

* **queue:** add option to skip metas update ([b7dd925](https://github.com/taskforcesh/bullmq/commit/b7dd925e7f2a4468c98a05f3a3ca1a476482b6c0))
* **queue:** add queue version support ([#2822](https://github.com/taskforcesh/bullmq/issues/2822)) ([3a4781b](https://github.com/taskforcesh/bullmq/commit/3a4781bf7cadf04f6a324871654eed8f01cdadae))

## [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)
Expand All @@ -16,6 +65,12 @@
# [7.17.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.16.0...v7.17.0) (2024-10-12)


### Bug Fixes

* **repeat:** also consider startDate when using "every" ([25bbaa8](https://github.com/taskforcesh/bullmq/commit/25bbaa81af87f9944a64bc4fb7e0c76ef223ada4))
* **sandbox:** catch exit errors ([#2800](https://github.com/taskforcesh/bullmq/issues/2800)) ([6babb9e](https://github.com/taskforcesh/bullmq/commit/6babb9e2f355feaf9bd1a8ed229c1001e6de7144))


### Features

* **repeat:** deprecate immediately on job scheduler ([ed047f7](https://github.com/taskforcesh/bullmq/commit/ed047f7ab69ebdb445343b6cb325e90b95ee9dc5))
Expand All @@ -25,11 +80,6 @@
* **worker-fork:** allow passing fork options ([#2795](https://github.com/taskforcesh/bullmq/issues/2795)) ([f7a4292](https://github.com/taskforcesh/bullmq/commit/f7a4292e064b41236f4489b3d7785a4c599a6435))
* **worker-thread:** allow passing Worker options ([#2791](https://github.com/taskforcesh/bullmq/issues/2791)) ref [#1555](https://github.com/taskforcesh/bullmq/issues/1555) ([6a1f7a9](https://github.com/taskforcesh/bullmq/commit/6a1f7a9f0303561d6ec7b2005ba0227132b89e07))

### Bug Fixes

* **repeat:** also consider startDate when using "every" ([25bbaa8](https://github.com/taskforcesh/bullmq/commit/25bbaa81af87f9944a64bc4fb7e0c76ef223ada4))
* **sandbox:** catch exit errors ([#2800](https://github.com/taskforcesh/bullmq/issues/2800)) ([6babb9e](https://github.com/taskforcesh/bullmq/commit/6babb9e2f355feaf9bd1a8ed229c1001e6de7144))

# [7.16.0](https://github.com/taskforcesh/bullmq-pro/compare/v7.15.4...v7.16.0) (2024-09-24)


Expand Down
21 changes: 21 additions & 0 deletions docs/gitbook/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## [5.26.2](https://github.com/taskforcesh/bullmq/compare/v5.26.1...v5.26.2) (2024-11-15)


### Bug Fixes

* **telemetry:** do not set span on parent context if undefined ([c417a23](https://github.com/taskforcesh/bullmq/commit/c417a23bb28d9effa42115e954b18cc41c1fc043))

## [5.26.1](https://github.com/taskforcesh/bullmq/compare/v5.26.0...v5.26.1) (2024-11-14)


### Bug Fixes

* **queue:** fix generics to be able to properly be extended ([f2495e5](https://github.com/taskforcesh/bullmq/commit/f2495e5ee9ecdb26492da510dc38730718cb28c5))

# [5.26.0](https://github.com/taskforcesh/bullmq/compare/v5.25.6...v5.26.0) (2024-11-14)


### Features

* improve queue getters to use generic job type ([#2905](https://github.com/taskforcesh/bullmq/issues/2905)) ([c9531ec](https://github.com/taskforcesh/bullmq/commit/c9531ec7a49126a017611eb2fd2eaea8fcb5ada5))

## [5.25.6](https://github.com/taskforcesh/bullmq/compare/v5.25.5...v5.25.6) (2024-11-11)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ Since BullMQ supports global pause, one possible strategy, if suitable for your
### Use new queues altogether

This drastic solution involves discontinuing use of older queues and creating new ones. You could rename older queues (e.g., "myQueueV2"), use a new Redis host, or maintain two versions of the service—one running an older BullMQ version with old queues, and a newer one with the latest BullMQ and a different set of queues. When the older version has no more jobs to process, it can be retired, leaving only the upgraded version.

25 changes: 25 additions & 0 deletions docs/gitbook/guide/migrations/v6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
description: Tips and hints on how to migrate to v6.
---

# Migration to v6

Make sure to call **runMigrations** method from Queue class in order to execute all necessary changes when coming from an older version.

## Migration of deprecated paused key

If you have paused queues after upgrading to this version. These jobs will be moved to wait state when initializing any of our instances (Worker, Queue, QueueEvents or FlowProducer).

Paused key is not longer needed as this state is already represented inside meta key. It also improves the process of pausing or resuming a queue as we don't need to rename any key.

## Remove legacy markers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are going to need more detailed information on how to safely perform the migration.


When migrating from versions before v5.
It's recommended to do this process:

1. Pause your queues.
2. Upgrade to v6.
3. Instantiate a Queue instance and execute runMigrations method where migrations will be executed.
4. Resume your queues.

This way you will prevent that your workers pick a legacy marker that is no longer used because new markers are added in a different structure.
2 changes: 1 addition & 1 deletion docs/gitbook/guide/redis-tm-compatibility/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Redis™ Compatibility

There are several alternatives for Redis and even though BullMQ is full Redis™ compliant, not all the alternatives are going to work properly. In this section we present the vendors that officially support BullMQ and that we regularly test to verify they keep staying compatible.
There are several alternatives for Redis and even though BullMQ is full Redis™ compliant with version 6.2.0 or newer, not all the alternatives are going to work properly. In this section we present the vendors that officially support BullMQ and that we regularly test to verify they keep staying compatible.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bullmq",
"version": "5.25.6",
"version": "5.26.2",
"description": "Queue for messages and jobs based on Redis",
"homepage": "https://bullmq.io/",
"main": "./dist/cjs/index.js",
Expand Down
2 changes: 1 addition & 1 deletion python/bullmq/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def getJobLogs(self, job_id:str, start = 0, end = -1, asc = True):
"logs": result[0],
"count": result[1]
}

async def obliterate(self, force: bool = False):
"""
Completely destroys the queue and all of its contents irreversibly.
Expand Down
45 changes: 26 additions & 19 deletions python/bullmq/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ def __init__(self, prefix: str, queueName: str, redisConnection: RedisConnection
self.redisConnection = redisConnection
self.redisClient = redisConnection.conn
self.commands = {
"addStandardJob": self.redisClient.register_script(self.getScript("addStandardJob-8.lua")),
"addStandardJob": self.redisClient.register_script(self.getScript("addStandardJob-7.lua")),
"addDelayedJob": self.redisClient.register_script(self.getScript("addDelayedJob-6.lua")),
"addParentJob": self.redisClient.register_script(self.getScript("addParentJob-4.lua")),
"addPrioritizedJob": self.redisClient.register_script(self.getScript("addPrioritizedJob-8.lua")),
"changePriority": self.redisClient.register_script(self.getScript("changePriority-7.lua")),
"changePriority": self.redisClient.register_script(self.getScript("changePriority-6.lua")),
"cleanJobsInSet": self.redisClient.register_script(self.getScript("cleanJobsInSet-3.lua")),
"extendLock": self.redisClient.register_script(self.getScript("extendLock-2.lua")),
"getCounts": self.redisClient.register_script(self.getScript("getCounts-1.lua")),
Expand All @@ -51,18 +51,19 @@ def __init__(self, prefix: str, queueName: str, redisConnection: RedisConnection
"getState": self.redisClient.register_script(self.getScript("getState-8.lua")),
"getStateV2": self.redisClient.register_script(self.getScript("getStateV2-8.lua")),
"isJobInList": self.redisClient.register_script(self.getScript("isJobInList-1.lua")),
"moveStalledJobsToWait": self.redisClient.register_script(self.getScript("moveStalledJobsToWait-9.lua")),
"moveToActive": self.redisClient.register_script(self.getScript("moveToActive-11.lua")),
"moveStalledJobsToWait": self.redisClient.register_script(self.getScript("moveStalledJobsToWait-8.lua")),
"moveToActive": self.redisClient.register_script(self.getScript("moveToActive-10.lua")),
"moveToDelayed": self.redisClient.register_script(self.getScript("moveToDelayed-8.lua")),
"moveToFinished": self.redisClient.register_script(self.getScript("moveToFinished-14.lua")),
"moveToFinished": self.redisClient.register_script(self.getScript("moveToFinished-13.lua")),
"moveToWaitingChildren": self.redisClient.register_script(self.getScript("moveToWaitingChildren-5.lua")),
"obliterate": self.redisClient.register_script(self.getScript("obliterate-2.lua")),
"pause": self.redisClient.register_script(self.getScript("pause-7.lua")),
"promote": self.redisClient.register_script(self.getScript("promote-9.lua")),
"promote": self.redisClient.register_script(self.getScript("promote-8.lua")),
"removeJob": self.redisClient.register_script(self.getScript("removeJob-2.lua")),
"reprocessJob": self.redisClient.register_script(self.getScript("reprocessJob-8.lua")),
"retryJob": self.redisClient.register_script(self.getScript("retryJob-11.lua")),
"moveJobsToWait": self.redisClient.register_script(self.getScript("moveJobsToWait-8.lua")),
"migrateDeprecatedPausedKey": self.redisClient.register_script(self.getScript("migrateDeprecatedPausedKey-2.lua")),
"reprocessJob": self.redisClient.register_script(self.getScript("reprocessJob-7.lua")),
"retryJob": self.redisClient.register_script(self.getScript("retryJob-10.lua")),
"moveJobsToWait": self.redisClient.register_script(self.getScript("moveJobsToWait-7.lua")),
"saveStacktrace": self.redisClient.register_script(self.getScript("saveStacktrace-1.lua")),
"updateData": self.redisClient.register_script(self.getScript("updateData-1.lua")),
"updateProgress": self.redisClient.register_script(self.getScript("updateProgress-3.lua")),
Expand Down Expand Up @@ -131,7 +132,7 @@ def addStandardJob(self, job: Job, timestamp: int, pipe = None):
"""
Add a standard job to the queue
"""
keys = self.getKeys(['wait', 'paused', 'meta', 'id',
keys = self.getKeys(['wait', 'meta', 'id',
'completed', 'active', 'events', 'marker'])
args = self.addJobArgs(job, None)
args.append(timestamp)
Expand Down Expand Up @@ -259,15 +260,15 @@ def saveStacktraceArgs(self, job_id: str, stacktrace: str, failedReason: str):
return (keys, args)

def retryJobArgs(self, job_id: str, lifo: bool, token: str, opts: dict = {}):
keys = self.getKeys(['active', 'wait', 'paused'])
keys = self.getKeys(['active', 'wait'])
keys.append(self.toKey(job_id))
keys.append(self.keys['meta'])
keys.append(self.keys['events'])
keys.append(self.keys['delayed'])
keys.append(self.keys['prioritized'])
keys.append(self.keys['pc'])
keys.append(self.keys['marker'])
keys.append(self.keys['stalled'])
keys.append(self.keys['marker'])

push_cmd = "RPUSH" if lifo else "LPUSH"

Expand Down Expand Up @@ -302,7 +303,6 @@ def promoteArgs(self, job_id: str):
keys = self.getKeys(['delayed', 'wait', 'paused', 'meta', 'prioritized', 'active', 'pc', 'events', 'marker'])
keys.append(self.toKey(job_id))
keys.append(self.keys['events'])
keys.append(self.keys['paused'])
keys.append(self.keys['meta'])

args = [self.keys[''], job_id]
Expand Down Expand Up @@ -374,7 +374,6 @@ async def isJobInList(self, list_key: str, job_id: str):

async def changePriority(self, job_id: str, priority:int = 0, lifo:bool = False):
keys = [self.keys['wait'],
self.keys['paused'],
self.keys['meta'],
self.keys['prioritized'],
self.keys['active'],
Expand Down Expand Up @@ -408,7 +407,6 @@ async def reprocessJob(self, job: Job, state: str):
keys.append(self.keys[state])
keys.append(self.keys['wait'])
keys.append(self.keys['meta'])
keys.append(self.keys['paused'])
keys.append(self.keys['active'])
keys.append(self.keys['marker'])

Expand Down Expand Up @@ -450,7 +448,7 @@ async def obliterate(self, count: int, force: bool = False):

def moveJobsToWaitArgs(self, state: str, count: int, timestamp: int) -> int:
keys = self.getKeys(
['', 'events', state, 'wait', 'paused', 'meta', 'active', 'marker'])
['', 'events', state, 'wait', 'meta', 'active', 'marker'])

args = [count or 1000, timestamp or round(time.time()*1000), state]
return (keys, args)
Expand All @@ -465,6 +463,15 @@ async def retryJobs(self, state: str, count: int, timestamp: int):
result = await self.commands["moveJobsToWait"](keys=keys, args=args)
return result

async def migrateDeprecatedPausedKey(self, maxCount: int):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this? I think for migration users should use the migration script available in the NodeJs for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what I think we need in the python version is to throw an exception if you are trying to run this version on an older BullMQ version that has not yet been migrated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add this logic in a following pr

keys = self.getKeys(
['paused', 'wait'])

args = [maxCount]

result = await self.commands["migrateDeprecatedPausedKey"](keys=keys, args=args)
return result

async def promoteJobs(self, count: int):
"""
Promote jobs in delayed state
Expand All @@ -483,7 +490,7 @@ async def moveToActive(self, token: str, opts: dict) -> list[Any]:
limiter = opts.get("limiter", None)

keys = self.getKeys(['wait', 'active', 'prioritized', 'events',
'stalled', 'limiter', 'delayed', 'paused', 'meta', 'pc', 'marker'])
'stalled', 'limiter', 'delayed', 'meta', 'pc', 'marker'])
packedOpts = msgpack.packb(
{"token": token, "lockDuration": lockDuration, "limiter": limiter}, use_bin_type=True)
args = [self.keys[''], timestamp, packedOpts]
Expand Down Expand Up @@ -516,7 +523,7 @@ def moveToFinishedArgs(self, job: Job, val: Any, propVal: str, shouldRemove, tar
metricsKey = self.toKey('metrics:' + target)

keys = self.getKeys(['wait', 'active', 'prioritized', 'events',
'stalled', 'limiter', 'delayed', 'paused', 'meta', 'pc', target])
'stalled', 'limiter', 'delayed', 'meta', 'pc', target])
keys.append(self.toKey(job.id))
keys.append(metricsKey)
keys.append(self.keys['marker'])
Expand Down Expand Up @@ -580,7 +587,7 @@ def extendLock(self, jobId: str, token: str, duration: int, client: Redis = None

def moveStalledJobsToWait(self, maxStalledCount: int, stalledInterval: int):
keys = self.getKeys(['stalled', 'wait', 'active', 'failed',
'stalled-check', 'meta', 'paused', 'marker', 'events'])
'stalled-check', 'meta', 'marker', 'events'])
args = [maxStalledCount, self.keys[''], round(
time.time() * 1000), stalledInterval]
return self.commands["moveStalledJobsToWait"](keys, args)
Expand Down
10 changes: 0 additions & 10 deletions src/classes/job-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,3 @@ export const defaultRepeatStrategy = (
// Ignore error
}
};

function removeUndefinedFields(obj: Record<string, any>) {
const newObj: Record<string, any> = {};
for (const key in obj) {
if (obj[key] !== undefined) {
newObj[key] = obj[key];
}
}
return newObj;
}
2 changes: 1 addition & 1 deletion src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ const logger = debuglog('bull');

const optsDecodeMap = {
de: 'deduplication',
ocf: 'onChildFailure',
fpof: 'failParentOnFailure',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't we need to keep this old mappings to not cause a data breaking change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should introduce a "migration" mechanism here. Something like migration steps for going between versions that are run if required in Lua scripts for atomicity. But we would need to keep a version number in the meta key, adding complexity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can keep this mappings that will be only used to format options of jobs with these old values, but no migration is needed as we are evaluation old and new option in lua scripts, new jobs will use new option

idof: 'ignoreDependencyOnFailure',
kl: 'keepLogs',
ocf: 'onChildFailure',
rdof: 'removeDependencyOnFailure',
tm: 'telemetryMetadata'
};
Expand Down
Loading
Loading