feat: remove arbitrary timeout

This commit is contained in:
wpetit 2023-03-23 19:01:48 +01:00
parent 0577762be9
commit 9eefce9b41

View File

@ -1,12 +1,9 @@
package memory
import (
"context"
"sync"
"time"
"forge.cadoles.com/arcad/edge/pkg/bus"
"gitlab.com/wpetit/goweb/logger"
)
type eventDispatcherSet struct {
@ -89,8 +86,6 @@ func (d *eventDispatcher) IsOut(out <-chan bus.Message) bool {
}
func (d *eventDispatcher) Run() {
ctx := context.Background()
for {
msg, ok := <-d.in
if !ok {
@ -99,12 +94,7 @@ func (d *eventDispatcher) Run() {
return
}
timeout := time.After(2 * time.Second)
select {
case d.out <- msg:
case <-timeout:
logger.Error(ctx, "message out chan timed out", logger.F("message", msg))
}
d.out <- msg
}
}