@@ -91,25 +91,14 @@ func (b *monoprocessBackend) CompleteWorkflowTask(
91
91
return err
92
92
}
93
93
94
- hasWorkflowTasks := false
95
- hasActivityTasks := false
96
-
97
- for _ , e := range executedEvents {
98
- if e .Type == history .EventType_WorkflowTaskStarted {
99
- hasWorkflowTasks = true
100
- break
101
- }
102
- }
103
- for _ , e := range activityEvents {
104
- if e .Type == history .EventType_ActivityScheduled {
105
- hasActivityTasks = true
106
- break
107
- }
94
+ if len (activityEvents ) > 0 {
95
+ b .notifyActivityWorker (ctx )
108
96
}
97
+
109
98
for _ , e := range timerEvents {
110
99
attr , ok := e .Attributes .(* history.TimerFiredAttributes )
111
100
if ! ok {
112
- b .logger .Warn ( "unknown attributes type in timer event" , "type" , reflect .TypeOf (e .Attributes ).String ())
101
+ b .logger .WarnContext ( ctx , "unknown attributes type in timer event" , "type" , reflect .TypeOf (e .Attributes ).String ())
113
102
continue
114
103
}
115
104
b .logger .DebugContext (ctx , "scheduling timer to notify workflow worker" )
@@ -118,22 +107,8 @@ func (b *monoprocessBackend) CompleteWorkflowTask(
118
107
// and continue.
119
108
time .AfterFunc (attr .At .Sub (time .Now ()), func () { b .notifyWorkflowWorker (context .Background ()) })
120
109
}
121
- for _ , e := range workflowEvents {
122
- if e .HistoryEvent .Type == history .EventType_WorkflowExecutionStarted ||
123
- e .HistoryEvent .Type == history .EventType_SubWorkflowCompleted ||
124
- e .HistoryEvent .Type == history .EventType_WorkflowExecutionCanceled {
125
- hasWorkflowTasks = true
126
- break
127
- }
128
- }
129
110
130
- // notify workers about potential new tasks
131
- if hasWorkflowTasks {
132
- b .notifyWorkflowWorker (ctx )
133
- }
134
- if hasActivityTasks {
135
- b .notifyActivityWorker (ctx )
136
- }
111
+ b .notifyWorkflowWorker (ctx )
137
112
return nil
138
113
}
139
114
0 commit comments