zlacker

[parent] [thread] 8 comments
1. chx+(OP)[view] [source] 2021-06-12 09:14:17
Successful items are deleted from the queue before they expire. So an item with expired > current time needs to be retried because it failed processing. So, a cronjob resets these to expire 0 and the next worker can pick them up.
replies(4): >>edwiny+V7 >>layout+p8 >>ptx+d9 >>johbjo+zH
2. edwiny+V7[view] [source] 2021-06-12 10:43:55
>>chx+(OP)
Thanks for the explanation and time is needed in order to digest it... I guess one might start with the simple "status" field approach ;)
replies(1): >>Dangit+CB
3. layout+p8[view] [source] 2021-06-12 10:49:21
>>chx+(OP)
Doesn’t sound like a robust solution. What if the job takes longer than your estimated expire time? Does the worker keep updating the expiry date on a background thread while doing the processing?
replies(1): >>cbo100+kg
4. ptx+d9[view] [source] 2021-06-12 10:59:23
>>chx+(OP)
You mean expired < current time, right?
◧◩
5. cbo100+kg[view] [source] [discussion] 2021-06-12 12:29:53
>>layout+p8
Same for any queuing system. You need to set the expiry time long enough for the expected task duration.

In SQS, for example, you use a visibility timeout set high enough that you will have time to finish the job and delete the message before SQS hand it off to another reader.

You won’t always finish in time though, so ideally jobs are idempotent.

◧◩
6. Dangit+CB[view] [source] [discussion] 2021-06-12 15:58:15
>>edwiny+V7
The status doesn't help if the worker died during processing. If you've got something that's been "in progress" for 20 minutes of a job that takes 2, your job might not be getting done. That's what expired is for.
replies(1): >>edwiny+RV4
7. johbjo+zH[view] [source] 2021-06-12 16:51:13
>>chx+(OP)
Could the process not delete the row, and not commit until it has finished processing? Otherwise, the transaction is rolled back when the db connection ends. This would not require timeout or clean-up.

One would need the appropriate transaction isolation, but shouldn't it work?

replies(1): >>Seattl+Hl1
◧◩
8. Seattl+Hl1[view] [source] [discussion] 2021-06-12 23:03:39
>>johbjo+zH
That's requires maintaining more db locks.
◧◩◪
9. edwiny+RV4[view] [source] [discussion] 2021-06-14 12:52:39
>>Dangit+CB
I see now! So the 'expired' field is for checking died/incompleted workers.
[go to top]