@@ -140,28 +140,16 @@ func ApplyActions(s *protos.OrchestrationRuntimeState, customStatus *wrapperspb.
140
140
},
141
141
Router : action .Router ,
142
142
})
143
- if s .StartEvent .GetParentInstance () != nil {
144
- // Create a router for the completion event that routes back to the parent
143
+ if parentInstance := s .StartEvent .GetParentInstance (); parentInstance != nil {
145
144
var completionRouter * protos.TaskRouter
146
- if action .Router != nil {
147
- var parentAppID * string
148
-
149
- allEvents := append (s .OldEvents , s .NewEvents ... )
150
- for _ , event := range allEvents {
151
- if es := event .GetExecutionStarted (); es != nil && event .GetRouter () != nil {
152
- parentAppID = ptr .Of (event .GetRouter ().GetSourceAppID ())
153
- break
154
- }
155
- }
156
145
157
- if parentAppID != nil {
158
- completionRouter = & protos.TaskRouter {
159
- SourceAppID : action .Router .SourceAppID ,
160
- TargetAppID : parentAppID ,
161
- }
162
- } else {
163
- completionRouter = action .Router
146
+ if parentInstance .AppID != nil {
147
+ completionRouter = & protos.TaskRouter {
148
+ SourceAppID : action .Router .GetSourceAppID (),
149
+ TargetAppID : ptr .Of (parentInstance .GetAppID ()),
164
150
}
151
+ } else {
152
+ completionRouter = action .Router
165
153
}
166
154
167
155
msg := & protos.OrchestrationRuntimeStateMessage {
@@ -261,6 +249,7 @@ func ApplyActions(s *protos.OrchestrationRuntimeState, customStatus *wrapperspb.
261
249
TaskScheduledId : action .Id ,
262
250
Name : wrapperspb .String (s .StartEvent .Name ),
263
251
OrchestrationInstance : & protos.OrchestrationInstance {InstanceId : string (s .InstanceId )},
252
+ AppID : ptr .Of (action .Router .GetSourceAppID ()),
264
253
},
265
254
Input : createSO .Input ,
266
255
OrchestrationInstance : & protos.OrchestrationInstance {
0 commit comments