Merge pull request #3737 from nspcc-dev/fix-timer-drain

services: fix timer draining
This commit is contained in:
Roman Khimov 2024-12-09 15:06:30 +03:00 committed by GitHub
commit 727262a95a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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()