diff options
author | Rony Lutsky <ronlut@gmail.com> | 2023-02-10 02:26:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-10 07:26:03 +0700 |
commit | b69ee10cbba78789e48ce44fa69f14715d94b7a5 (patch) | |
tree | 5d72626562c2fd0c4887f6776d53a7a52016473e /tests | |
parent | acdeff385daf5157e6646dfb47a02f92e6b19b3a (diff) | |
download | rq-b69ee10cbba78789e48ce44fa69f14715d94b7a5.tar.gz |
Fix - Use worker TTL for timeout (#1794)
* Use worker TTL for timeout
* add test
* renames
* test
* use dequeue_timeout
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_worker.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_worker.py b/tests/test_worker.py index b0bb3d7..cfce473 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -642,6 +642,16 @@ class TestWorker(RQTestCase): # Put it on the queue with a timeout value self.assertIsNone(w.dequeue_job_and_maintain_ttl(None)) + def test_worker_ttl_param_resolves_timeout(self): + """Ensures the worker_ttl param is being considered in the dequeue_timeout and connection_timeout params, takes into account 15 seconds gap (hard coded)""" + q = Queue() + w = Worker([q]) + self.assertEqual(w.dequeue_timeout, 405) + self.assertEqual(w.connection_timeout, 415) + w = Worker([q], default_worker_ttl=500) + self.assertEqual(w.dequeue_timeout, 485) + self.assertEqual(w.connection_timeout, 495) + def test_worker_sets_result_ttl(self): """Ensure that Worker properly sets result_ttl for individual jobs.""" q = Queue() |