From 56c89c1334e9df043035cb68a930fb634f7c1d33 Mon Sep 17 00:00:00 2001 From: Benjamin Root Date: Fri, 6 Jan 2017 17:17:42 -0500 Subject: [PATCH] Trigger a refresh after job execution * Prevents clobbering of user-supplied metadata modified during the job execution --- rq/worker.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rq/worker.py b/rq/worker.py index 4549b55..fb7047a 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -705,6 +705,7 @@ class Worker(object): try: with self.death_penalty_class(job.timeout or self.queue_class.DEFAULT_TIMEOUT): rv = job.perform() + job.refresh() job.ended_at = utcnow() @@ -718,6 +719,7 @@ class Worker(object): started_job_registry=started_job_registry ) except Exception: + job.refresh() self.handle_job_failure( job=job, started_job_registry=started_job_registry