diff options
author | Rony Lutsky <ronlut@gmail.com> | 2023-02-05 12:41:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-05 17:41:56 +0700 |
commit | 54db2fa8d1af221485870ddf7c5707cd704c73c7 (patch) | |
tree | c41ea0b8ddf046831862d4c0b4690142e4d20897 /tests | |
parent | 83fa0adf15daf718fac416214529072ac297293d (diff) | |
download | rq-54db2fa8d1af221485870ddf7c5707cd704c73c7.tar.gz |
Fix - TypeError - accessing None when dequeued result is None (when timeout=None, e.g. in burst mode) (#1793)
* fix accessing None when dequeued result is None (burst=True, or timeout=None)
* add a test
* pr fix
* fix tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_worker.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_worker.py b/tests/test_worker.py index e001a95..b0bb3d7 100644 --- a/tests/test_worker.py +++ b/tests/test_worker.py @@ -634,6 +634,14 @@ class TestWorker(RQTestCase): res.refresh() self.assertIn('JobTimeoutException', as_text(res.exc_info)) + def test_dequeue_job_and_maintain_ttl_non_blocking(self): + """Not passing a timeout should return immediately with None as a result""" + q = Queue() + w = Worker([q]) + + # Put it on the queue with a timeout value + self.assertIsNone(w.dequeue_job_and_maintain_ttl(None)) + def test_worker_sets_result_ttl(self): """Ensure that Worker properly sets result_ttl for individual jobs.""" q = Queue() |