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

Is there an ignoreLock option for moveToCompleted? #1138

Closed
Pro-Ton opened this issue Mar 16, 2022 · 6 comments
Closed

Is there an ignoreLock option for moveToCompleted? #1138

Pro-Ton opened this issue Mar 16, 2022 · 6 comments

Comments

@Pro-Ton
Copy link

Pro-Ton commented Mar 16, 2022

Hi, In the Bull3 I had a manual handling queue in which clients sent completed jobs to a REST endpoint and I could move them to completed like this:

const id = req.params.id;
const returnValue = req.body;
const job = await tasksQ.getJob(id);
await job?.moveToCompleted(returnValue , true, true);

But in the BullMQ I wasn't able to produce such functionality:

I tried:

const job = await tasksQ.getJob(id);   // Also: await Job.fromId(tasksQ, id);
await job.moveToCompleted(returnValue, 'my-token', false);

But I get exception:
Error: Missing lock for job 14.

Clearly there was an option to ignoreLock in the previous version. I searched the docs but couldn't find similar option. Is there any options or other way of doing such functionality?

Thanks for the amazing work.

@manast
Copy link
Contributor

manast commented Mar 16, 2022

@manast manast closed this as completed Mar 16, 2022
@Pro-Ton
Copy link
Author

Pro-Ton commented Mar 16, 2022

Thanks for your comment, I've read that page. But my use case is different.

When I use getNextJob I'm able to moveToCompleted the returned job.
But the problem is that I'm not able to use getNextJob because the external worker is outside the scope of my node application.
It provides the job ID, so I should get the job by it's ID, moveToCompleted the job, and save it's returnvalue.

@manast
Copy link
Contributor

manast commented Mar 16, 2022

Then use the same token id for everything and it should work.

@Niek
Copy link
Contributor

Niek commented Mar 22, 2022

@Pro-Ton did you find a solution for this? I have the exact same use-case (manually processing jobs, given a specific ID), and the following code doesn't work:

const job = await queue.getJob(id)
job && job.moveToCompleted('returndata', 'token', false)

It throws with the error Error: Missing lock for job <ID>. finished

@StringKe
Copy link

@Niek Did you solve this problem?

@Niek
Copy link
Contributor

Niek commented Jul 30, 2022

@StringKe not really - see #1152 for a more extensive discussion.

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

No branches or pull requests

4 participants