diff options
author | Marcus Ong <marcus.ong404@gmail.com> | 2023-03-03 07:02:07 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-03 06:02:07 +0700 |
commit | e92682c83aefda9475eba3dd9fe0ef42575d92b7 (patch) | |
tree | 0a4e383f6bef517cf27cdb601a0a67e9373aaba7 /tests | |
parent | ed59b9248aeb87c566661d0f5ee2c2e934c41440 (diff) | |
download | rq-e92682c83aefda9475eba3dd9fe0ef42575d92b7.tar.gz |
Fix TimerDeathPenalty not properly handling negative/infinite timeout (#1845)
* Fix TimerDeathPenalty not properly handling negative/infinite timeout
* revert back to using exc_info
---------
Co-authored-by: Marcus <marcus@us2.ai>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_timeouts.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_timeouts.py b/tests/test_timeouts.py index 2872ee0..1f392a3 100644 --- a/tests/test_timeouts.py +++ b/tests/test_timeouts.py @@ -42,3 +42,10 @@ class TestTimeouts(RQTestCase): self.assertIn(job, failed_job_registry)
job.refresh()
self.assertIn("rq.timeouts.JobTimeoutException", job.exc_info)
+
+ # Test negative timeout doesn't raise JobTimeoutException,
+ # which implies an unintended immediate timeout.
+ job = q.enqueue(thread_friendly_sleep_func, args=(1,), job_timeout=-1)
+ w.work(burst=True)
+ job.refresh()
+ self.assertIn(job, finished_job_registry)
|