Really totally insane rambling.
Reference in task_run doesn't block worker two executing the
function...

So, another rambling:
In order to avoid it, at the cost of firing two queries on
task_scheduled table, wouldn't be better to "sign" the task_scheduled
with, say, worker_heartbeat.id and then check, after the first commit,
if the same record is being taken up by another worker?

Something like:

1. worker 1 fetches task_scheduled.id=1 and updates the record with
worker_id=1 and status=running
2. commit()
3. worker 1 re-fetches task_scheduled.id=1 and checks if worker_id is
still == 1
4. task_run record is inserted
5. db.commit()

and so on...

would this kind of approach seal the deal or it's a "chicken and egg"
problem and we'd need to separate delicate processes "intelligently"
using task_scheduled.group_name and only a worker doing those ?

Reply via email to