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

Issues with queue in v10 #463

Closed
stefanvanherwijnen opened this issue Jul 25, 2024 · 6 comments
Closed

Issues with queue in v10 #463

stefanvanherwijnen opened this issue Jul 25, 2024 · 6 comments

Comments

@stefanvanherwijnen
Copy link

Hi,

I noticed a few issues while trying to migrate to v10.

import PgBoss from "pg-boss";

const boss = new PgBoss('postgres://user:pass@host/database');

boss.on("error", console.error);

await boss.start();

const queue = "readme-queue";

console.log(await boss.getQueueSize(queue));
if (!(await boss.getQueueSize(queue))) {
  await boss.createQueue(queue);
}
const id = await boss.send(queue, { arg1: "read me" });
await boss.schedule(queue + ":test", "* * * * *", { data: "data" });
console.log(`created job ${id} in queue ${queue}`);

await boss.work(queue + ":*", async (job) => {
  console.log(`received job ${job.id} with data ${JSON.stringify(job.data)}`);
});

Firstly, createQueue() does not seem to be optional and not creating a queue before sending a job to it result in no running jobs at all.

Secondly, using a wildcard in a worker does not seem to work at all (the worker never runs).

Third, running deleteQueue(queue) doesn´t seem to delete the created table and will result in an error when createQueue(queue) is ran after it (error: relation "job_1cf8f2ada856014a7b8b7f085da16cd67a05144a5830a720f1a98755" already exists).

@timgit
Copy link
Owner

timgit commented Jul 26, 2024

Creating queues is required starting in v10. Wildcards are also currently not supported. These changes are listed in the beta release notes.

@stefanvanherwijnen
Copy link
Author

Thanks. I know creating queues is required in v10, but the createQueue documentation states it is an optional step so I was confused. I also couldn't find anything about the wildcard support in the release notes.

I'll keep this open until v10 is released in case anyone else runs into the same problem.

@timgit timgit closed this as completed Aug 17, 2024
@OyugoObonyo
Copy link

@stefanvanherwijnen did you figure out how to delete the queue and its created table?

@stefanvanherwijnen
Copy link
Author

@stefanvanherwijnen did you figure out how to delete the queue and its created table?

No, but on startup I check if a queue already exists before creating it. Deleting a queue shouldn't be necessary.

@OyugoObonyo
Copy link

By on startup, do you mean when starting your application or is it a check every time you want to interact with a queue?

@stefanvanherwijnen
Copy link
Author

When I start the app. If you try to recreate an existing queue it will throw an error.

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

3 participants