Skip to content

Commit

Permalink
Also test task locks & queue locks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasst committed Apr 24, 2024
1 parent 6fe6daf commit a829c07
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/test_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,20 @@ def test_handles_timeout(self, tiger, ensure_queues):
ensure_queues(error={"default": 1})

def test_heartbeat(self, tiger):
task = Task(tiger, sleep_task)
# Test both task heartbeat and lock renewal.
task = Task(tiger, sleep_task, lock=True)
task.delay()

# Start a worker and wait until it starts processing.
worker = Process(
target=external_worker,
kwargs={
"patch_config": {"ACTIVE_TASK_UPDATE_TIMER": DELAY / 2},
"worker_kwargs": {"executor_class": SyncExecutor},
"worker_kwargs": {
# Test queue lock.
"max_workers_per_queue": 1,
"executor_class": SyncExecutor,
},
},
)
worker.start()
Expand Down

0 comments on commit a829c07

Please sign in to comment.