Skip to content

Commit

Permalink
services: fix timer draining
Browse files Browse the repository at this point in the history
Ref. #3736.

Signed-off-by: Anna Shaleva <[email protected]>
  • Loading branch information
AnnaShaleva committed Dec 9, 2024
1 parent 35c2c5c commit 827acfc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/services/rpcsrv/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Check warning on line 476 in pkg/services/rpcsrv/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/services/rpcsrv/server.go#L474-L476

Added lines #L474 - L476 were not covered by tests
}
}
session.iteratorsLock.Unlock()
}
Expand Down Expand Up @@ -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:

Check warning on line 2604 in pkg/services/rpcsrv/server.go

View check run for this annotation

Codecov / codecov/patch

pkg/services/rpcsrv/server.go#L2602-L2604

Added lines #L2602 - L2604 were not covered by tests
}
}
delete(s.sessions, strSID)
session.iteratorsLock.Unlock()
Expand Down

0 comments on commit 827acfc

Please sign in to comment.