diff --git a/src/rex.job/src/rex/job/workers/job_queuer.py b/src/rex.job/src/rex/job/workers/job_queuer.py index 966d63977..5a1ee6a79 100644 --- a/src/rex.job/src/rex/job/workers/job_queuer.py +++ b/src/rex.job/src/rex/job/workers/job_queuer.py @@ -33,8 +33,10 @@ )) ''' +# Note that we only change the status to queued if it is still new. +# This is to avoid a race condition where the job may already be completed/failed. HTSQL_UPDATE_NEW = ''' -/job[$job]{ +/job[$job].filter(status='new'){ id(), 'queued' :as status, }