mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-04 23:45:07 +00:00
do not run triggers in go routines, they seem to deadlock
This commit is contained in:
parent
657c2a5408
commit
2a03da2127
@ -154,20 +154,11 @@ func init() {
|
||||
// triggerBatch calls Trigger on every handler in a seperate Go routine.
|
||||
// The returned context is the context returned by the Trigger that finishes last.
|
||||
func triggerBatch(ctx context.Context, handlers ...*handler.Handler) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(handlers))
|
||||
|
||||
for _, h := range handlers {
|
||||
go func(ctx context.Context, h *handler.Handler) {
|
||||
name := h.ProjectionName()
|
||||
_, traceSpan := tracing.NewNamedSpan(ctx, fmt.Sprintf("Trigger%s", name))
|
||||
_, err := h.Trigger(ctx, handler.WithAwaitRunning())
|
||||
logging.OnError(err).WithField("projection", name).Debug("trigger failed")
|
||||
traceSpan.EndWithError(err)
|
||||
|
||||
wg.Done()
|
||||
}(ctx, h)
|
||||
name := h.ProjectionName()
|
||||
_, traceSpan := tracing.NewNamedSpan(ctx, fmt.Sprintf("Trigger%s", name))
|
||||
_, err := h.Trigger(ctx, handler.WithAwaitRunning())
|
||||
logging.OnError(err).WithField("projection", name).Debug("trigger failed")
|
||||
traceSpan.EndWithError(err)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user