@@ -201,29 +201,29 @@ func (rb *redisBackend) CompleteWorkflowTask(
201
201
}
202
202
203
203
// Send new workflow events to the respective streams
204
- groupedEvents := history .EventsByWorkflowInstance (workflowEvents )
205
- for targetInstance , events := range groupedEvents {
204
+ groupedEvents := history .EventsByWorkflowInstanceID (workflowEvents )
205
+ for targetInstanceID , events := range groupedEvents {
206
206
// Insert pending events for target instance
207
- for _ , event := range events {
208
- event := event
207
+ for _ , m := range events {
208
+ m := m
209
209
210
- if event .Type == history .EventType_WorkflowExecutionStarted {
210
+ if m . HistoryEvent .Type == history .EventType_WorkflowExecutionStarted {
211
211
// Create new instance
212
- a := event .Attributes .(* history.ExecutionStartedAttributes )
213
- if err := createInstanceP (ctx , p , & targetInstance , a .Metadata , true ); err != nil {
212
+ a := m . HistoryEvent .Attributes .(* history.ExecutionStartedAttributes )
213
+ if err := createInstanceP (ctx , p , m . WorkflowInstance , a .Metadata , true ); err != nil {
214
214
return err
215
215
}
216
216
}
217
217
218
218
// Add pending event to stream
219
- if err := addEventToStreamP (ctx , p , pendingEventsKey (targetInstance . InstanceID ), & event ); err != nil {
219
+ if err := addEventToStreamP (ctx , p , pendingEventsKey (targetInstanceID ), & m . HistoryEvent ); err != nil {
220
220
return err
221
221
}
222
222
}
223
223
224
224
// Try to queue workflow task
225
- if targetInstance != * instance {
226
- if err := rb .workflowQueue .Enqueue (ctx , p , targetInstance . InstanceID , nil ); err != nil {
225
+ if targetInstanceID != instance . InstanceID {
226
+ if err := rb .workflowQueue .Enqueue (ctx , p , targetInstanceID , nil ); err != nil {
227
227
return fmt .Errorf ("enqueuing workflow task: %w" , err )
228
228
}
229
229
}
0 commit comments