feat: remove arbitrary timeout

This commit is contained in:
wpetit 2023-03-23 19:01:48 +01:00
parent 0577762be9
commit 9eefce9b41
1 changed files with 1 additions and 11 deletions

View File

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