revert back job.cleanup changes

main
Alexey Katichev 8 years ago
parent b7d50cedc4
commit 09697e567f

@ -606,12 +606,9 @@ class Job(object):
self.delete(pipeline=pipeline, remove_from_queue=remove_from_queue)
elif not ttl:
return
else:
elif ttl > 0:
connection = pipeline if pipeline is not None else self.connection
if ttl > 0:
connection.expire(self.key, ttl)
else:
connection.persist(self.key)
def register_dependency(self, pipeline=None):
"""Jobs may have dependencies. Jobs are enqueued only if the job they

@ -654,9 +654,10 @@ class TestFailedQueue(RQTestCase):
def test_job_in_failed_queue_persists(self):
"""Make sure failed job key does not expire"""
q = Queue('foo')
job = q.enqueue(div_by_zero, args=(1, 2, 3), ttl=5)
job = q.enqueue(div_by_zero, args=(1,), ttl=5)
self.assertEqual(self.testconn.ttl(job.key), 5)
self.assertRaises(ZeroDivisionError, job.perform)
job.set_status(JobStatus.FAILED)
failed_queue = get_failed_queue()
failed_queue.quarantine(job, Exception('Some fake error'))

Loading…
Cancel
Save