@@ -151,22 +151,17 @@ func (a *Applier) Actions(s *protos.WorkflowRuntimeState, customStatus *wrappers
151151 FireAt : timerAction .FireAt ,
152152 Name : timerAction .Name ,
153153 }
154- if externalEvent := timerAction .GetExternalEvent (); externalEvent != nil {
155- timerCreated .Origin = & protos.TimerCreatedEvent_ExternalEvent {
156- ExternalEvent : externalEvent ,
157- }
158- } else if ct := timerAction .GetCreateTimer (); ct != nil {
159- timerCreated .Origin = & protos.TimerCreatedEvent_CreateTimer {
160- CreateTimer : ct ,
161- }
162- } else if ar := timerAction .GetActivityRetry (); ar != nil {
163- timerCreated .Origin = & protos.TimerCreatedEvent_ActivityRetry {
164- ActivityRetry : ar ,
165- }
166- } else if cwr := timerAction .GetChildWorkflowRetry (); cwr != nil {
167- timerCreated .Origin = & protos.TimerCreatedEvent_ChildWorkflowRetry {
168- ChildWorkflowRetry : cwr ,
169- }
154+ switch o := timerAction .GetOrigin ().(type ) {
155+ case * protos.CreateTimerAction_CreateTimer :
156+ timerCreated .Origin = & protos.TimerCreatedEvent_CreateTimer {CreateTimer : o .CreateTimer }
157+ case * protos.CreateTimerAction_ExternalEvent :
158+ timerCreated .Origin = & protos.TimerCreatedEvent_ExternalEvent {ExternalEvent : o .ExternalEvent }
159+ case * protos.CreateTimerAction_ActivityRetry :
160+ timerCreated .Origin = & protos.TimerCreatedEvent_ActivityRetry {ActivityRetry : o .ActivityRetry }
161+ case * protos.CreateTimerAction_ChildWorkflowRetry :
162+ timerCreated .Origin = & protos.TimerCreatedEvent_ChildWorkflowRetry {ChildWorkflowRetry : o .ChildWorkflowRetry }
163+ default :
164+ return false , fmt .Errorf ("unknown timer origin type: %T" , timerAction .GetOrigin ())
170165 }
171166 _ = AddEvent (s , & protos.HistoryEvent {
172167 EventId : action .Id ,
0 commit comments