routing: move statTicker to prevent race condition
This commit is contained in:
parent
21a40daf58
commit
b392dd1b95
@ -852,7 +852,6 @@ func (r *ChannelRouter) networkHandler() {
|
||||
graphPruneTicker := time.NewTicker(r.cfg.GraphPruneInterval)
|
||||
defer graphPruneTicker.Stop()
|
||||
|
||||
r.statTicker.Resume()
|
||||
defer r.statTicker.Stop()
|
||||
|
||||
r.stats.Reset()
|
||||
@ -862,6 +861,12 @@ func (r *ChannelRouter) networkHandler() {
|
||||
validationBarrier := NewValidationBarrier(runtime.NumCPU()*4, r.quit)
|
||||
|
||||
for {
|
||||
|
||||
// If there are stats, resume the statTicker.
|
||||
if !r.stats.Empty() {
|
||||
r.statTicker.Resume()
|
||||
}
|
||||
|
||||
select {
|
||||
// A new fully validated network update has just arrived. As a
|
||||
// result we'll modify the channel graph accordingly depending
|
||||
@ -1344,8 +1349,6 @@ func (r *ChannelRouter) processUpdate(msg interface{}) error {
|
||||
return errors.Errorf("wrong routing update message type")
|
||||
}
|
||||
|
||||
r.statTicker.Resume()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user