mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-22 19:19:09 +00:00
services: fix timer draining
Ref. #3736. Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
parent
35c2c5cc0e
commit
827acfca23
1 changed files with 8 additions and 2 deletions
|
@ -471,7 +471,10 @@ func (s *Server) Shutdown() {
|
||||||
session.iteratorsLock.Lock()
|
session.iteratorsLock.Lock()
|
||||||
session.finalize()
|
session.finalize()
|
||||||
if !session.timer.Stop() {
|
if !session.timer.Stop() {
|
||||||
<-session.timer.C
|
select {
|
||||||
|
case <-session.timer.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
session.iteratorsLock.Unlock()
|
session.iteratorsLock.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -2596,7 +2599,10 @@ func (s *Server) terminateSession(reqParams params.Params) (any, *neorpc.Error)
|
||||||
session.iteratorsLock.Lock()
|
session.iteratorsLock.Lock()
|
||||||
session.finalize()
|
session.finalize()
|
||||||
if !session.timer.Stop() {
|
if !session.timer.Stop() {
|
||||||
<-session.timer.C
|
select {
|
||||||
|
case <-session.timer.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delete(s.sessions, strSID)
|
delete(s.sessions, strSID)
|
||||||
session.iteratorsLock.Unlock()
|
session.iteratorsLock.Unlock()
|
||||||
|
|
Loading…
Reference in a new issue