File tree Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Expand file tree Collapse file tree 4 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ def initialize(details)
125125 continued_run_id : ProtoUtils . string_or ( @init_job . continued_from_execution_run_id ) ,
126126 cron_schedule : ProtoUtils . string_or ( @init_job . cron_schedule ) ,
127127 execution_timeout : ProtoUtils . duration_to_seconds ( @init_job . workflow_execution_timeout ) ,
128+ first_execution_run_id : @init_job . first_execution_run_id ,
128129 headers : ProtoUtils . headers_from_proto_map ( @init_job . headers , @payload_converter ) || { } ,
129130 last_failure : if @init_job . continued_failure
130131 @failure_converter . from_failure ( @init_job . continued_failure , @payload_converter )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ module Workflow
77 :continued_run_id ,
88 :cron_schedule ,
99 :execution_timeout ,
10+ :first_execution_run_id ,
1011 :headers ,
1112 :last_failure ,
1213 :last_result ,
@@ -35,6 +36,8 @@ module Workflow
3536 # @return [String, nil] Cron schedule if applicable.
3637 # @!attribute execution_timeout
3738 # @return [Float, nil] Execution timeout for the workflow.
39+ # @!attribute first_execution_run_id
40+ # @return [String] The very first run ID the workflow ever had, following continuation chains.
3841 # @!attribute headers
3942 # @return [Hash<String, Api::Common::V1::Payload>] Headers.
4043 # @!attribute last_failure
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ module Temporalio
55 attr_reader continued_run_id: String?
66 attr_reader cron_schedule: String?
77 attr_reader execution_timeout: Float?
8+ attr_reader first_execution_run_id: String
89 attr_reader headers: Hash[String, untyped ]
910 attr_reader last_failure: Exception?
1011 attr_reader last_result: Object?
@@ -26,6 +27,7 @@ module Temporalio
2627 continued_run_id: String?,
2728 cron_schedule: String?,
2829 execution_timeout: Float?,
30+ first_execution_run_id: String,
2931 headers: Hash[String, untyped ],
3032 last_failure: Exception?,
3133 last_result: Object?,
Original file line number Diff line number Diff line change 44require 'gc_utils'
55require 'net/http'
66require 'temporalio/client'
7+ require 'temporalio/error'
78require 'temporalio/testing'
89require 'temporalio/worker'
910require 'temporalio/workflow'
@@ -542,6 +543,10 @@ def execute(past_run_ids)
542543 return past_run_ids if past_run_ids . size == 5
543544
544545 past_run_ids << Temporalio ::Workflow . info . continued_run_id if Temporalio ::Workflow . info . continued_run_id
546+ if !past_run_ids . empty? && Temporalio ::Workflow . info . first_execution_run_id != past_run_ids . first
547+ raise Temporalio ::Error ::ApplicationError . new ( 'wrong first_execution_run_id' , non_retryable : true )
548+ end
549+
545550 raise Temporalio ::Workflow ::ContinueAsNewError . new (
546551 past_run_ids ,
547552 memo : { past_run_id_count : past_run_ids . size } ,
You can’t perform that action at this time.
0 commit comments