From 158b33404b0c882202474e0ae80a121f5778a3d4 Mon Sep 17 00:00:00 2001 From: Anton Berezhnyi Date: Sat, 14 Oct 2023 10:51:36 +0300 Subject: [PATCH] Addtimeout before read confirmed channels --- eventloop.go | 2 ++ eventloop_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/eventloop.go b/eventloop.go index 4257215..dd674e3 100644 --- a/eventloop.go +++ b/eventloop.go @@ -8,6 +8,7 @@ import ( "os/signal" "runtime" "syscall" + "time" ) type EventLoop struct { @@ -34,6 +35,7 @@ func (eventLoop *EventLoop) execute() { go eventLoop.dispatchConfirmedEvent(ctx) runtime.Gosched() + time.Sleep(time.Millisecond * 300) eventLoop.dispatchIncomingEvent(ctx) } diff --git a/eventloop_test.go b/eventloop_test.go index f260af6..0067aa4 100644 --- a/eventloop_test.go +++ b/eventloop_test.go @@ -81,7 +81,7 @@ func TestEventLoopExecute(t *testing.T) { currentYearWatcher: currentYearWatcher, } - timeout := time.After(time.Millisecond * 500) + timeout := time.After(time.Second) done := make(chan bool) go func() { eventLoop.execute()