From 827acfca238b8916faad59c59af70de693c5bd09 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 9 Dec 2024 12:10:15 +0300 Subject: [PATCH] services: fix timer draining Ref. #3736. Signed-off-by: Anna Shaleva --- pkg/services/rpcsrv/server.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/services/rpcsrv/server.go b/pkg/services/rpcsrv/server.go index b6d0949a6..194ddf162 100644 --- a/pkg/services/rpcsrv/server.go +++ b/pkg/services/rpcsrv/server.go @@ -471,7 +471,10 @@ func (s *Server) Shutdown() { session.iteratorsLock.Lock() session.finalize() if !session.timer.Stop() { - <-session.timer.C + select { + case <-session.timer.C: + default: + } } session.iteratorsLock.Unlock() } @@ -2596,7 +2599,10 @@ func (s *Server) terminateSession(reqParams params.Params) (any, *neorpc.Error) session.iteratorsLock.Lock() session.finalize() if !session.timer.Stop() { - <-session.timer.C + select { + case <-session.timer.C: + default: + } } delete(s.sessions, strSID) session.iteratorsLock.Unlock()