-
Notifications
You must be signed in to change notification settings - Fork 68
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
Quirrel queue is blocked indefinitely by using exclusive: true
#739
Comments
When I schedule them everything seems fine:
But the endpoint is never called :( |
Hey Simon! I've attempted to queue about 5 or 10 jobs over the past couple of hours and none of them are triggering. |
Thank you. Looking into it now. |
I did get a weird error right before it stopped working, probably unrelated to Quirrel but I'll paste it here anyway. I'm not doing anything with base64 so it was a bit odd.
|
Oh, that is indeed not unrelated! Could you update to v1.7.1 and tell me if that fixes your issue? |
@Skn0tt I'm already on 1.7.1
|
Hmm, interesting. The log you posted is related to Quirrel's E2E encryption and was fixed via #677. I then suspect you're observing a different error now. Looking into it. |
Should I try deleting |
This is what my enqueue code looks like too, in case there's anything helpful (e.g null as payload):
|
No, that won't help. I had a look at Quirrel's production database, and it seems like there's a case where queues with |
exclusive: true
Whenever you get a chance! We'll just have to delay a few products from releasing until Monday, which isn't a huge issue. |
Okay. Will try sorting this tonight, but can't guarantee anything. |
Digging through the logs, I find some entries that make me think your Queue enqueues jobs into itself, re-using IDs. A bit like this: const queue = Queue<Product | null>("/api/raffle", async (payload, { id }) => {
if (!payload) {
const product = await getProduct(id)
await queue.enqueue(product, { id, override: true, exclusive: true });
}
})
export default queue
// somewhere:
queue.enqueue(null, { id: "....", delay: "3 seconds", override: true, exclusive: true }); Can you confirm that? |
I did some more testing, and this seems to indeed be the case. Here's roughly what happens:
This can not only occur because a queue enqueues into itself, but also because of bad timing in general. I'll prioritise introducing a fix for that.
Please let me know if this resolved the issue you're seeing. |
Yes that's right. First I enqueue the job when people enter a raffle:
And then when the raffle has ended it needs to be run x (unknown) amount of times to charge all of the winners. Each batch sets up another callback via quirrel using:
|
The thing is though, to me, the queue ID being the product ID is a good way of making sure it's never called back multiple times. And I use it to look up all the product information required to finalise the raffle. |
I see. Is there a way for you to split up the two kinds of work into two different queues? |
Or by appending some incrementing counter to the second call's ID? |
Well there's really only one job. If I sent |
I guess a counter could work, but it does concern me that I'll somehow end up queuing multiple for the same product and then charge extra people accidentally. |
It only sets up another queue once it's finished processing the current one — as Vercel has a 60s limit on serverless functions. So that's why I have it set up to "start again" under the same ID to sort of continue where it left off. |
It seems like I was able to fix the issue: quirrel-dev/owl#180 I hope I can get this merged & shipped tomorrow 🤞 |
Thank you! |
Will I have to change endpoints or ids? |
Alright, fix is merged & deployed! You'll have to change the endpoint. |
I'm not too sure what the issue is, but my api endpoints aren't being called.
Are you able to lookup my account and figure out why it's not working?
The domain is hal.vercel.app
The text was updated successfully, but these errors were encountered: