mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
blockfetcher: change shutdown logic
Move the `isActive` check earlier to enable faster shutdown and prevent the service from hanging. Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
8216f538c3
commit
df05cd2858
1 changed files with 1 additions and 1 deletions
|
@ -492,6 +492,7 @@ func (bfs *Service) exiter() {
|
|||
zap.Bool("force", force),
|
||||
)
|
||||
|
||||
bfs.isActive.CompareAndSwap(true, false)
|
||||
// Cansel all pending OIDs/blocks downloads in case if shutdown requested by user
|
||||
// or caused by downloading error.
|
||||
if force {
|
||||
|
@ -516,7 +517,6 @@ func (bfs *Service) exiter() {
|
|||
// the server know about it.
|
||||
_ = bfs.pool.Close()
|
||||
_ = bfs.log.Sync()
|
||||
bfs.isActive.CompareAndSwap(true, false)
|
||||
bfs.shutdownCallback()
|
||||
|
||||
// Notify Shutdown routine in case if it's user-triggered shutdown.
|
||||
|
|
Loading…
Reference in a new issue