From 3e586bd6d6a827ca447308181c6a73885981c801 Mon Sep 17 00:00:00 2001
From: Christophe Olinger <christophe@olinger.eu>
Date: Tue, 15 Dec 2015 08:25:05 +0100
Subject: [PATCH] Add remove current_job based on the correct upstream master
 branch

---
 rq/worker.py         | 1 +
 tests/test_worker.py | 1 +
 2 files changed, 2 insertions(+)

diff --git a/rq/worker.py b/rq/worker.py
index 8bcb02f..529f98d 100644
--- a/rq/worker.py
+++ b/rq/worker.py
@@ -594,6 +594,7 @@ class Worker(object):
             except Exception:
                 job.set_status(JobStatus.FAILED, pipeline=pipeline)
                 started_job_registry.remove(job, pipeline=pipeline)
+                self.set_current_job_id(None, pipeline=pipeline)
                 try:
                     pipeline.execute()
                 except Exception:
diff --git a/tests/test_worker.py b/tests/test_worker.py
index 48298ee..a81444f 100644
--- a/tests/test_worker.py
+++ b/tests/test_worker.py
@@ -157,6 +157,7 @@ class TestWorker(RQTestCase):
         # Postconditions
         self.assertEqual(q.count, 0)
         self.assertEqual(failed_q.count, 1)
+        self.assertEquals(w.get_current_job_id(), None)
 
         # Check the job
         job = Job.fetch(job.id)