@@ -40,7 +40,7 @@ use temporal_sdk_core_protos::{
4040 coresdk:: {
4141 ActivityHeartbeat , ActivitySlotInfo ,
4242 activity_result:: { self as ar, activity_execution_result as aer} ,
43- activity_task:: { ActivityCancelReason , ActivityTask } ,
43+ activity_task:: { ActivityCancelReason , ActivityCancellationDetails , ActivityTask } ,
4444 } ,
4545 temporal:: api:: {
4646 failure:: v1:: { ApplicationFailureInfo , CanceledFailureInfo , Failure , failure:: FailureInfo } ,
@@ -65,16 +65,19 @@ type OutstandingActMap = Arc<DashMap<TaskToken, RemoteInFlightActInfo>>;
6565struct PendingActivityCancel {
6666 task_token : TaskToken ,
6767 reason : ActivityCancelReason ,
68- /// Set true if we should assume the server has already forgotten about this activity
69- consider_not_found : bool ,
68+ details : ActivityCancellationDetails ,
7069}
7170
7271impl PendingActivityCancel {
73- fn new ( task_token : TaskToken , reason : ActivityCancelReason ) -> Self {
72+ fn new (
73+ task_token : TaskToken ,
74+ reason : ActivityCancelReason ,
75+ details : ActivityCancellationDetails ,
76+ ) -> Self {
7477 Self {
7578 task_token,
7679 reason,
77- consider_not_found : false ,
80+ details ,
7881 }
7982 }
8083}
@@ -508,13 +511,14 @@ where
508511 } else {
509512 details. issued_cancel_to_lang = Some ( next_pc. reason ) ;
510513 if next_pc. reason == ActivityCancelReason :: NotFound
511- || next_pc. consider_not_found
514+ || next_pc. details . is_not_found
512515 {
513516 details. known_not_found = true ;
514517 }
515518 Some ( Ok ( ActivityTask :: cancel_from_ids (
516519 next_pc. task_token . 0 ,
517520 next_pc. reason ,
521+ next_pc. details ,
518522 ) ) )
519523 }
520524 } else {
@@ -566,6 +570,9 @@ where
566570 let _ = cancels_tx. send ( PendingActivityCancel :: new (
567571 tt,
568572 ActivityCancelReason :: WorkerShutdown ,
573+ ActivityTask :: primary_reason_to_cancellation_details (
574+ ActivityCancelReason :: WorkerShutdown ,
575+ ) ,
569576 ) ) ;
570577 } else {
571578 // Fire off task to keep track of local timeouts. We do this so that
@@ -611,11 +618,15 @@ where
611618 "Timing out activity due to elapsed local \
612619 {timeout_type} timer"
613620 ) ;
614- let _ = cancel_tx. send ( PendingActivityCancel {
615- task_token : tt,
616- reason : ActivityCancelReason :: TimedOut ,
617- consider_not_found : true ,
618- } ) ;
621+ let _ = cancel_tx. send ( PendingActivityCancel :: new (
622+ tt,
623+ ActivityCancelReason :: TimedOut ,
624+ ActivityCancellationDetails {
625+ is_not_found : true ,
626+ is_timed_out : true ,
627+ ..Default :: default ( )
628+ } ,
629+ ) ) ;
619630 } ) ) ;
620631 outstanding_info. timeout_resetter = resetter;
621632 }
@@ -639,6 +650,9 @@ where
639650 let _ = self . cancels_tx . send ( PendingActivityCancel :: new (
640651 mapref. key ( ) . clone ( ) ,
641652 ActivityCancelReason :: WorkerShutdown ,
653+ ActivityTask :: primary_reason_to_cancellation_details (
654+ ActivityCancelReason :: WorkerShutdown ,
655+ ) ,
642656 ) ) ;
643657 }
644658 }
0 commit comments