Add optional pipeline parameter to set_state.

main
Marc Brinkmann 11 years ago
parent e4589a4641
commit 606d4fa10f

@ -215,9 +215,11 @@ class Worker(object):
p.expire(self.key, 60) p.expire(self.key, 60)
p.execute() p.execute()
def set_state(self, new_state): def set_state(self, new_state, pipeline=None):
self._state = new_state 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): def get_state(self):
return self._state return self._state

Loading…
Cancel
Save