From 606d4fa10f9f20480b4d5dca6c11c54431d63758 Mon Sep 17 00:00:00 2001 From: Marc Brinkmann Date: Wed, 25 Sep 2013 10:32:21 +0200 Subject: [PATCH] Add optional pipeline parameter to set_state. --- rq/worker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 09af23c..25195a0 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -215,9 +215,11 @@ class Worker(object): p.expire(self.key, 60) p.execute() - def set_state(self, new_state): + def set_state(self, new_state, pipeline=None): self._state = new_state - self.connection.hset(self.key, 'state', new_state) + + connection = pipeline if pipeline is not None else self.connection + connection.hset(self.key, 'state', new_state) def get_state(self): return self._state