Skip to content

Commit e055766

Browse files
committed
include is_worker_shutdown as reason for requested cancellation, test fix
1 parent 58bd687 commit e055766

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

temporalio/worker/_activity.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,10 @@ def _cancel(
217217
activity.cancellation_details.details = (
218218
temporalio.activity.ActivityCancellationDetails._from_proto(cancel.details)
219219
)
220-
activity.cancel(cancelled_by_request=cancel.details.is_cancelled)
220+
activity.cancel(
221+
cancelled_by_request=cancel.details.is_cancelled
222+
or cancel.details.is_worker_shutdown
223+
)
221224

222225
def _heartbeat(self, task_token: bytes, *details: Any) -> None:
223226
# We intentionally make heartbeating non-async, but since the data
@@ -494,7 +497,8 @@ async def _run_activity(
494497
)
495498
await self._data_converter.encode_failure(
496499
temporalio.exceptions.ApplicationError(
497-
"Unhandled activity cancel error produced by activity pause"
500+
type="ActivityPause",
501+
message="Unhandled activity cancel error produced by activity pause",
498502
),
499503
completion.result.failed.failure,
500504
)

0 commit comments

Comments
 (0)