|
|
@ -318,26 +318,25 @@ class TestFailedJobRegistry(RQTestCase):
|
|
|
|
|
|
|
|
|
|
|
|
timestamp = current_timestamp()
|
|
|
|
timestamp = current_timestamp()
|
|
|
|
registry.add(job)
|
|
|
|
registry.add(job)
|
|
|
|
self.assertLess(
|
|
|
|
score = self.testconn.zscore(key, job.id)
|
|
|
|
self.testconn.zscore(key, job.id),
|
|
|
|
self.assertLess(score, timestamp + DEFAULT_FAILURE_TTL + 2)
|
|
|
|
timestamp + DEFAULT_FAILURE_TTL + 2
|
|
|
|
self.assertGreater(score, timestamp + DEFAULT_FAILURE_TTL - 2)
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertGreater(
|
|
|
|
# Job key will also expire
|
|
|
|
self.testconn.zscore(key, job.id),
|
|
|
|
job_ttl = self.testconn.ttl(job.key)
|
|
|
|
timestamp + DEFAULT_FAILURE_TTL - 2
|
|
|
|
self.assertLess(job_ttl, DEFAULT_FAILURE_TTL + 2)
|
|
|
|
)
|
|
|
|
self.assertGreater(job_ttl, DEFAULT_FAILURE_TTL - 2)
|
|
|
|
|
|
|
|
|
|
|
|
timestamp = current_timestamp()
|
|
|
|
timestamp = current_timestamp()
|
|
|
|
ttl = 5
|
|
|
|
ttl = 5
|
|
|
|
registry.add(job, ttl=5)
|
|
|
|
registry.add(job, ttl=ttl)
|
|
|
|
self.assertLess(
|
|
|
|
score = self.testconn.zscore(key, job.id)
|
|
|
|
self.testconn.zscore(key, job.id),
|
|
|
|
self.assertLess(score, timestamp + ttl + 2)
|
|
|
|
timestamp + ttl + 2
|
|
|
|
self.assertGreater(score, timestamp + ttl - 2)
|
|
|
|
)
|
|
|
|
|
|
|
|
self.assertGreater(
|
|
|
|
job_ttl = self.testconn.ttl(job.key)
|
|
|
|
self.testconn.zscore(key, job.id),
|
|
|
|
self.assertLess(job_ttl, ttl + 2)
|
|
|
|
timestamp + ttl - 2
|
|
|
|
self.assertGreater(job_ttl, ttl - 2)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_requeue(self):
|
|
|
|
def test_requeue(self):
|
|
|
|
"""FailedJobRegistry.requeue works properly"""
|
|
|
|
"""FailedJobRegistry.requeue works properly"""
|
|
|
|