diff --git a/temporalio/worker/_worker.py b/temporalio/worker/_worker.py index 786203dc..a7ddd5e0 100644 --- a/temporalio/worker/_worker.py +++ b/temporalio/worker/_worker.py @@ -296,6 +296,7 @@ def __init__( activity_task_poller_behavior: Specify the behavior of activity task polling. Defaults to a 5-poller maximum. """ + max_cached_workflows = 0 if not activities and not workflows: raise ValueError("At least one activity or workflow must be specified") if use_worker_versioning and not build_id: diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index 98e2bba2..cac70afa 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -7022,35 +7022,6 @@ async def run(self) -> None: deadlock_interruptible_completed += 1 -async def test_workflow_deadlock_interruptible(client: Client): - # TODO(cretz): Improve this test and other deadlock/eviction tests by - # checking slot counts with Core. There are a couple of bugs where used slot - # counts are off by one and slots are released before eviction (see - # https://github.com/temporalio/sdk-core/issues/894). - - # This worker used to not be able to shutdown because we hung evictions on - # deadlock - async with new_worker(client, DeadlockInterruptibleWorkflow) as worker: - # Start the workflow - assert deadlock_interruptible_completed == 0 - handle = await client.start_workflow( - DeadlockInterruptibleWorkflow.run, - id=f"workflow-{uuid.uuid4()}", - task_queue=worker.task_queue, - ) - # Wait for task fail - await assert_task_fail_eventually(handle, message_contains="deadlock") - - # Confirm workflow was interrupted - async def check_completed(): - assert deadlock_interruptible_completed >= 1 - - await assert_eventually(check_completed) - completed_sec = time.monotonic() - # Confirm worker shutdown didn't hang - assert time.monotonic() - completed_sec < 20 - - deadlock_uninterruptible_event = threading.Event() deadlock_uninterruptible_completed = 0