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

Open
wants to merge 27 commits into
base: v6
Choose a base branch
from

Conversation

roggervalf
Copy link
Collaborator

No description provided.

@roggervalf roggervalf changed the base branch from master to v6 September 12, 2024 05:43
@roggervalf roggervalf changed the base branch from v6 to master September 13, 2024 00:42
@roggervalf roggervalf changed the base branch from master to v6 September 13, 2024 01:42
@roggervalf roggervalf changed the base branch from v6 to master September 14, 2024 02:51
Copy link
Contributor

@manast manast left a comment

Choose a reason for hiding this comment

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

Some initial comments, more will come.

@@ -16,13 +16,13 @@ const originalTree = await flow.add({
name,
data: { idx: 0, foo: 'bar' },
queueName: 'childrenQueueName',
opts: { failParentOnFailure: true },
opts: { onChildFailure: 'fail' },
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice change.

@@ -451,6 +462,15 @@ async def retryJobs(self, state: str, count: int, timestamp: int):
result = await self.commands["moveJobsToWait"](keys=keys, args=args)
return result

async def repairDeprecatedPausedKey(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.

We need proper documentation on how and when a call to this method is needed.

@@ -39,10 +39,8 @@ const logger = debuglog('bull');

const optsDecodeMap = {
de: 'debounce',
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

@@ -1210,27 +1208,6 @@ export class Job<
throw new Error(`Delay and repeat options could not be used together`);
}

if (this.opts.removeDependencyOnFailure && this.opts.failParentOnFailure) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice to be able to remove this

/**
* Remove legacy markers before v5
*/
removeLegacyMarkers(): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Documentation about this is also needed. Most importantly practical information in how to apply something like this in the context of a production deployment.

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 added a me migrations section for it

*
* @param maxCount - Max quantity of jobs to be moved to wait per iteration.
*/
async repairDeprecatedPausedKey(maxCount: number = 1000): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should "repair" be the proper name or actually something like "migrate" would be more accurate?

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 can change it, let me do it

@roggervalf roggervalf changed the base branch from master to v6 September 20, 2024 12:28
@roggervalf roggervalf changed the base branch from v6 to master September 21, 2024 04:31
@roggervalf roggervalf changed the base branch from master to v6 September 21, 2024 14:10
@roggervalf roggervalf changed the base branch from v6 to master September 24, 2024 03:54
@roggervalf roggervalf changed the base branch from master to v6 September 24, 2024 04:24
@roggervalf roggervalf changed the base branch from v6 to master September 26, 2024 04:58
@roggervalf roggervalf changed the base branch from master to v6 September 26, 2024 04:59
@roggervalf roggervalf changed the base branch from v6 to master September 27, 2024 01:29
@roggervalf roggervalf changed the base branch from master to v6 September 27, 2024 01:54
@roggervalf roggervalf changed the base branch from v6 to master September 27, 2024 03:08
@roggervalf roggervalf changed the base branch from master to v6 September 28, 2024 15:47
@roggervalf roggervalf changed the base branch from v6 to master October 1, 2024 14:53
@roggervalf roggervalf changed the base branch from master to v6 October 1, 2024 14:55
@roggervalf roggervalf changed the base branch from v6 to master October 1, 2024 17:04
@roggervalf roggervalf changed the base branch from master to v6 October 8, 2024 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants