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

keyPrefix issue no data passed, Error: Missing lock for job (v5) #116

Closed
jericopulvera opened this issue May 19, 2022 · 1 comment
Closed

Comments

@jericopulvera
Copy link
Contributor

jericopulvera commented May 19, 2022

Description of bug
keyPrefix breaks the Queue process

To Reproduce

Steps to reproduce the behavior:

  1. Create Fresh Adonis v5
  2. Install Adonis Bull for v5 using Adonis server runtime
  3. Add any keyPrefix value e.g keyPrefix: 'c1'
  4. Reload the Adonis server.
  5. Add something to the Queue.
  6. Check the bullboard.

Expected behavior

The job receives data and is processed successfully.

Exception or Error


Error: Missing lock for job 1. failed
    at Scripts.finishedErrors (/Users/jericopulvera/Code/hello-world/node_modules/bullmq/src/classes/scripts.ts:341:16)
    at Job.moveToFailed (/Users/jericopulvera/Code/hello-world/node_modules/bullmq/src/classes/job.ts:523:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at handleFailed (/Users/jericopulvera/Code/hello-world/node_modules/bullmq/src/classes/worker.ts:581:9)
    at Worker.retryIfFailed (/Users/jericopulvera/Code/hello-world/node_modules/bullmq/src/classes/worker.ts:725:16)
    at Worker.run (/Users/jericopulvera/Code/hello-world/node_modules/bullmq/src/classes/worker.ts:351:34)

Screenshots

With keyPrefix
image

Without keyPrefix
image

@jericopulvera jericopulvera changed the title keyPrefix issue no data passed, Error: Missing lock for job keyPrefix issue no data passed, Error: Missing lock for job (v5) May 19, 2022
@jericopulvera
Copy link
Contributor Author

The fix would be to use a prefix key in WorkerOptions and QueueOptions.

Unfortunately, the QueueOptions is not typed and you'll have to ignore it.

import { JobContract, QueueOptions, WorkerOptions } from "@ioc:Rocketseat/Bull";
import Env from "@ioc:Adonis/Core/Env";

const prefix = Env.get("BULL_PREFIX");

export default class UserRegisterEmail implements JobContract {
  public key = "UserRegisterEmail";

  public queueOptions: QueueOptions = {
    // @ts-ignore
    prefix,
  };

  public workerOptions: WorkerOptions = {
    prefix,
  };

  public async handle(job) {
    console.log(job.data, this.key);

    return job.data;
  }
}

Issue details can be found in the BullMQ repo.
taskforcesh/bullmq#424

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

1 participant