multi: make sure missionControlStore catches done signal

This commit makes sure `missionControlStore` catches the shutdown signal
when draining the ticker. A few debug logs are added to aid the process.
This commit is contained in:
yyforyongyu
2024-07-16 01:04:36 +08:00
parent 50279464ad
commit 2608c0893e
6 changed files with 25 additions and 10 deletions

View File

@@ -125,6 +125,9 @@ func (b *BitcoindFilteredChainView) Start() error {
//
// NOTE: This is part of the FilteredChainView interface.
func (b *BitcoindFilteredChainView) Stop() error {
log.Debug("BitcoindFilteredChainView stopping")
defer log.Debug("BitcoindFilteredChainView stopped")
// Already shutting down?
if atomic.AddInt32(&b.stopped, 1) != 1 {
return nil
@@ -136,8 +139,6 @@ func (b *BitcoindFilteredChainView) Stop() error {
b.blockQueue.Stop()
log.Infof("FilteredChainView stopping")
close(b.quit)
b.wg.Wait()

View File

@@ -135,6 +135,9 @@ func (b *BtcdFilteredChainView) Start() error {
//
// NOTE: This is part of the FilteredChainView interface.
func (b *BtcdFilteredChainView) Stop() error {
log.Debug("BtcdFilteredChainView stopping")
defer log.Debug("BtcdFilteredChainView stopped")
// Already shutting down?
if atomic.AddInt32(&b.stopped, 1) != 1 {
return nil
@@ -146,8 +149,6 @@ func (b *BtcdFilteredChainView) Stop() error {
b.blockQueue.Stop()
log.Infof("FilteredChainView stopping")
close(b.quit)
b.wg.Wait()

View File

@@ -135,13 +135,14 @@ func (c *CfFilteredChainView) Start() error {
//
// NOTE: This is part of the FilteredChainView interface.
func (c *CfFilteredChainView) Stop() error {
log.Debug("CfFilteredChainView stopping")
defer log.Debug("CfFilteredChainView stopped")
// Already shutting down?
if atomic.AddInt32(&c.stopped, 1) != 1 {
return nil
}
log.Infof("FilteredChainView stopping")
close(c.quit)
c.blockQueue.Stop()
c.wg.Wait()