Store birth and death values as UTC dates.

main
Vincent Driessen 11 years ago
parent d037696fc5
commit aefa44b30c

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

Loading…
Cancel
Save