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

[Bug]: Debounced job ID not being returned on new flow job creation #2780

Open
1 task done
fakhir opened this issue Sep 25, 2024 · 3 comments
Open
1 task done

[Bug]: Debounced job ID not being returned on new flow job creation #2780

fakhir opened this issue Sep 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@fakhir
Copy link

fakhir commented Sep 25, 2024

Version

v5.12.12

Platform

NodeJS

What happened?

I had been using plain queue based jobs in the past, along with the debouncing feature. But recently I needed to create jobs with debouncing + parent/child jobs, so I switched to using Flows.

Now the problem that I'm facing is that when I call flowProducer.add() with the following options:

const jobNode = await flowProducer.add({
        name: myJobName,
        queueName: myQueueName,
        data: myJobData,
        opts: {
          debounce: { id: myDebounceId },
          removeOnComplete: 200,
          removeOnFail: 200
        },
        children: myChildJobs
      });

// jobNode.job.id here is always unique even for debounced jobs

The above call successfully debounces the job, but the returned jobNode.job.id is always a unique UUID identifier. If the job was debounced, then a job with the returned UUID doesn't exist in the queue, but the ID is still returned by the flowProducer.add() function. I am not specifying any job ID in the options, so I am relying on bullmq-generated job IDs.

I've been using similar code for debouncing jobs when using plain queues (instead of flows). When I call queue.add(), if the job is debounced, then the original job's ID is returned, which is very convenient. I would expect flows to behave in a similar manner, for consistency.

Reporting this as a bug, since I assume this isn't intentional behavior.

How to reproduce.

Create a flow based job using a flow producer using a debounce ID. And then create a second job using the same debounce ID (before the first job completes). The second job created will have a unique job id (based on UUID) even though it has been debounced and no such job has actually been created in the queue.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@fakhir fakhir added the bug Something isn't working label Sep 25, 2024
@roggervalf
Copy link
Collaborator

this functionality is not supported as this combinación implies also supporting more than one parent in a flow. We should throw an error in this case

@fakhir
Copy link
Author

fakhir commented Sep 26, 2024

Okay, so this relates to the discussion under #2416.

Can this still be supported with a limitation, for example, that debouncing would only be performed for the parent job and not for child jobs? That would probably avoid the multi-parent condition.

@roggervalf
Copy link
Collaborator

it could work for the root parent and yes it's related to that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants