runner: Update task status only after sending the tasks to rabbitmq
Prior to this, the runner called the `grab_ready{_priority}_tasks` method. Those method update the task's status to 'next_run_scheduled' at the listing time. So it actually writes immediately to postgresql. So, failing to write to rabbitmq would update the status anyway. So we change the runner's calls to use the `peek_ready{_priority}_tasks` methods instead. This now only gets the task list to schedule. And at the end of the runner, there is a call of `mass_schedule_task_runs` method. This method is now in charge to update the tasks' status to 'next_run_scheduled' within the same transaction. Refs. swh/infra/sysadm-environment#5512
Loading
Please register or sign in to comment