@@ -45,7 +45,7 @@ pub mod coresdk {
4545 use crate :: {
4646 ENCODING_PAYLOAD_KEY , JSON_ENCODING_VAL ,
4747 temporal:: api:: {
48- common:: v1:: { Payload , Payloads , WorkflowExecution } ,
48+ common:: v1:: { Payload , Payloads , RetryPolicy , WorkflowExecution } ,
4949 enums:: v1:: {
5050 ApplicationErrorCategory , TimeoutType , VersioningBehavior , WorkflowTaskFailedCause ,
5151 } ,
@@ -481,6 +481,7 @@ pub mod coresdk {
481481 FromPayloadsExt ,
482482 activity_result:: { ActivityResolution , activity_resolution} ,
483483 common:: NamespacedWorkflowExecution ,
484+ fix_retry_policy,
484485 workflow_activation:: remove_from_cache:: EvictionReason ,
485486 } ,
486487 temporal:: api:: {
@@ -745,7 +746,7 @@ pub mod coresdk {
745746 continued_failure : attrs. continued_failure ,
746747 last_completion_result : attrs. last_completion_result ,
747748 first_execution_run_id : attrs. first_execution_run_id ,
748- retry_policy : attrs. retry_policy ,
749+ retry_policy : attrs. retry_policy . map ( fix_retry_policy ) ,
749750 attempt : attrs. attempt ,
750751 cron_schedule : attrs. cron_schedule ,
751752 workflow_execution_expiration_time : attrs. workflow_execution_expiration_time ,
@@ -1298,7 +1299,7 @@ pub mod coresdk {
12981299 schedule_to_close_timeout : r. schedule_to_close_timeout ,
12991300 start_to_close_timeout : r. start_to_close_timeout ,
13001301 heartbeat_timeout : r. heartbeat_timeout ,
1301- retry_policy : r. retry_policy ,
1302+ retry_policy : r. retry_policy . map ( fix_retry_policy ) ,
13021303 priority : r. priority ,
13031304 is_local : false ,
13041305 } ,
@@ -1578,6 +1579,15 @@ pub mod coresdk {
15781579 }
15791580 }
15801581 }
1582+
1583+ /// If initial_interval is missing, fills it with zero value to prevent crashes
1584+ /// (lang assumes that RetryPolicy always has initial_interval set).
1585+ fn fix_retry_policy ( mut retry_policy : RetryPolicy ) -> RetryPolicy {
1586+ if retry_policy. initial_interval . is_none ( ) {
1587+ retry_policy. initial_interval = Default :: default ( ) ;
1588+ }
1589+ retry_policy
1590+ }
15811591}
15821592
15831593// No need to lint these
0 commit comments