Merge branch '4314-crunch-token-expire' refs #4314 refs #4310
[arvados.git] / services / api / script / crunch-dispatch.rb
index 2fc826651daf8f5e063bd925b6675d0945dc6ced..5d9323a5f677b1a669a327fe9c883dc21495a39f 100755 (executable)
@@ -342,6 +342,7 @@ class Dispatcher
         @job_tags[job.uuid] = job.script_version
       elsif @job_tags[job.uuid] != job.script_version
         fail_job job, "Existing tag #{job.uuid} points to commit #{@job_tags[job.uuid]} but this job uses commit #{job.script_version}"
+        next
       end
 
       cmd_args << crunch_job_bin
@@ -615,8 +616,11 @@ class Dispatcher
       # fine.
     end
 
-    # Invalidate the per-job auth token
-    j_done[:job_auth].update_attributes expires_at: Time.now
+    # Invalidate the per-job auth token, unless the job is still queued and we
+    # might want to try it again.
+    if jobrecord.state != "Queued"
+      j_done[:job_auth].update_attributes expires_at: Time.now
+    end
 
     @running.delete job_done.uuid
   end