|
|
|
@ -195,11 +195,10 @@ class Worker(object):
|
|
|
|
|
raise ValueError('There exists an active worker named \'%s\' '
|
|
|
|
|
'already.' % (self.name,))
|
|
|
|
|
key = self.key
|
|
|
|
|
now = time.time()
|
|
|
|
|
queues = ','.join(self.queue_names())
|
|
|
|
|
with self.connection._pipeline() as p:
|
|
|
|
|
p.delete(key)
|
|
|
|
|
p.hset(key, 'birth', now)
|
|
|
|
|
p.hset(key, 'birth', times.format(times.now(), 'UTC'))
|
|
|
|
|
p.hset(key, 'queues', queues)
|
|
|
|
|
p.sadd(self.redis_workers_keys, key)
|
|
|
|
|
p.expire(key, self.default_worker_ttl)
|
|
|
|
@ -212,7 +211,7 @@ class Worker(object):
|
|
|
|
|
# We cannot use self.state = 'dead' here, because that would
|
|
|
|
|
# rollback the pipeline
|
|
|
|
|
p.srem(self.redis_workers_keys, self.key)
|
|
|
|
|
p.hset(self.key, 'death', time.time())
|
|
|
|
|
p.hset(self.key, 'death', times.format(times.now(), 'UTC'))
|
|
|
|
|
p.expire(self.key, 60)
|
|
|
|
|
p.execute()
|
|
|
|
|
|
|
|
|
|