What's the best way to use web2py to process a queue of data in a cron
job without race conditions?
My code basically does this:
for task in db(status != 'done').select():
success = do_long_thing_with(task) # takes a long time, might
fail
if success:
task.update_record(status = 'done')
I launch this every N minutes in a cron job. But if it takes more
than N minutes to run, the cron starts another loop in parallel and
duplicates all calls to do_long_thing_with(task).
What's the best way to fix this? It seems hard without being able to
manually say where transactions should start with BEGIN.
--
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en.