Skip to content

Commit

Permalink
[KS-347] Start tracking registerTrigger goroutine (#13688)
Browse files Browse the repository at this point in the history
* [KS-347] Start tracking registerTrigger goroutine

* Check for channel closed

* Check for channel closed

---------

Co-authored-by: Bolek <[email protected]>
  • Loading branch information
cedric-cordenier and bolekk authored Jun 27, 2024
1 parent 96f332c commit 7a3ba8e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions core/services/workflows/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,25 @@ func (e *Engine) registerTrigger(ctx context.Context, t *triggerCapability, trig
}}
}

e.wg.Add(1)
go func() {
for event := range eventsCh {
e.triggerEvents <- event
defer e.wg.Done()

for {
select {
case <-e.stopCh:
return
case event, isOpen := <-eventsCh:
if !isOpen {
return
}

select {
case <-e.stopCh:
return
case e.triggerEvents <- event:
}
}
}
}()

Expand Down

0 comments on commit 7a3ba8e

Please sign in to comment.