Add expiry info to the worker log.

main
Vincent Driessen 13 years ago
parent 4b797fbf43
commit bc7e32bae8

@ -409,12 +409,16 @@ class Worker(object):
result_ttl = self.default_result_ttl if job.result_ttl is None else job.result_ttl # noqa result_ttl = self.default_result_ttl if job.result_ttl is None else job.result_ttl # noqa
if result_ttl == 0: if result_ttl == 0:
job.delete() job.delete()
self.log.info('Result discarded immediately.')
else: else:
p = self.connection.pipeline() p = self.connection.pipeline()
p.hset(job.key, 'result', pickled_rv) p.hset(job.key, 'result', pickled_rv)
p.hset(job.key, 'status', job._status) p.hset(job.key, 'status', job._status)
if result_ttl > 0: if result_ttl > 0:
p.expire(job.key, result_ttl) p.expire(job.key, result_ttl)
self.log.info('Result is kept for %d seconds.' % result_ttl)
else:
self.log.warning('Result will never expire, clean up result key manually.')
p.execute() p.execute()
return True return True

Loading…
Cancel
Save