@@ -107,6 +107,8 @@ type (
107107 decisions map [decisionID ]decisionStateMachine
108108
109109 scheduledEventIDToActivityID map [int64 ]string
110+
111+ scheduledEventIDToSignalID map [int64 ]string
110112 }
111113)
112114
@@ -636,6 +638,8 @@ func newDecisionsHelper() *decisionsHelper {
636638 decisions : make (map [decisionID ]decisionStateMachine ),
637639
638640 scheduledEventIDToActivityID : make (map [int64 ]string ),
641+
642+ scheduledEventIDToSignalID : make (map [int64 ]string ),
639643 }
640644}
641645
@@ -844,23 +848,32 @@ func (h *decisionsHelper) signalExternalWorkflowExecution(domain, workflowID, ru
844848 return decision
845849}
846850
847- func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionInitiated (signalID string ) {
851+ func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionInitiated (initiatedEventID int64 , signalID string ) {
852+ h .scheduledEventIDToSignalID [initiatedEventID ] = signalID
848853 decision := h .getDecision (makeDecisionID (decisionTypeSignal , signalID ))
849854 decision .handleInitiatedEvent ()
850855}
851856
852- func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionCompleted (signalID string ) decisionStateMachine {
853- decision := h .getDecision (makeDecisionID (decisionTypeSignal , signalID ))
857+ func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionCompleted (initiatedEventID int64 ) decisionStateMachine {
858+ decision := h .getDecision (makeDecisionID (decisionTypeSignal , h . getSignalID ( initiatedEventID ) ))
854859 decision .handleCompletionEvent ()
855860 return decision
856861}
857862
858- func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionFailed (signalID string ) decisionStateMachine {
859- decision := h .getDecision (makeDecisionID (decisionTypeSignal , signalID ))
863+ func (h * decisionsHelper ) handleSignalExternalWorkflowExecutionFailed (initiatedEventID int64 ) decisionStateMachine {
864+ decision := h .getDecision (makeDecisionID (decisionTypeSignal , h . getSignalID ( initiatedEventID ) ))
860865 decision .handleCompletionEvent ()
861866 return decision
862867}
863868
869+ func (h * decisionsHelper ) getSignalID (initiatedEventID int64 ) string {
870+ signalID , ok := h .scheduledEventIDToSignalID [initiatedEventID ]
871+ if ! ok {
872+ panic (fmt .Sprintf ("unable to find signal ID: %v" , initiatedEventID ))
873+ }
874+ return signalID
875+ }
876+
864877func (h * decisionsHelper ) startTimer (attributes * s.StartTimerDecisionAttributes ) decisionStateMachine {
865878 decision := newTimerDecisionStateMachine (attributes )
866879 h .addDecision (decision )
0 commit comments