only process jobs if they're pending

help prevent issues where scheduled jobs are processed twice. note this is NOT
a watertight solution - it holds no locks, and there is no guarantee that the
status won't have updated between asserting that its status is 'pending' and
updating it to be 'in progress'
This commit is contained in:
Leo Hemsted
2016-10-07 12:54:04 +01:00
parent 27c7a08523
commit d22d055e21

View File

@@ -36,6 +36,9 @@ def process_job(job_id):
start = datetime.utcnow()
job = dao_get_job_by_id(job_id)
if job.job_status != 'pending':
return
service = job.service
total_sent = fetch_todays_total_message_count(service.id)