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 committed 2024-07-23 21:30:08 +08:00
1 parent 50279464ad
commit 2608c0893e
6 files changed
+25 -10

No files matched your search

+11 -2
View File
@@ -303,7 +303,11 @@ func (b *missionControlStore) run() {
// channel needs to be drained appropriately. This could happen
// if the flushInterval is very small (e.g. 1 nanosecond).
if !timer.Stop() {
<-timer.C
select {
case <-timer.C:
case <-b.done:
log.Debugf("Stopping mission control store")
}
}
for {
@@ -335,7 +339,12 @@ func (b *missionControlStore) run() {
case <-b.done:
// Release the timer's resources.
if !timer.Stop() {
<-timer.C
select {
case <-timer.C:
case <-b.done:
log.Debugf("Mission control " +
"store stopped")
}
}
return
}