Commit d0da9fbb authored by acud's avatar acud Committed by GitHub

fix: faster kademlia startup (#2130)

parent 6d4c8ba6
...@@ -505,7 +505,7 @@ func (k *Kad) manage() { ...@@ -505,7 +505,7 @@ func (k *Kad) manage() {
select { select {
case <-k.quit: case <-k.quit:
return return
case <-time.After(30 * time.Second): case <-time.After(15 * time.Second):
start := time.Now() start := time.Now()
if err := k.collector.Flush(); err != nil { if err := k.collector.Flush(); err != nil {
k.metrics.InternalMetricsFlushTotalErrors.Inc() k.metrics.InternalMetricsFlushTotalErrors.Inc()
...@@ -588,6 +588,10 @@ func (k *Kad) Start(_ context.Context) error { ...@@ -588,6 +588,10 @@ func (k *Kad) Start(_ context.Context) error {
k.metrics.StartAddAddressBookOverlaysTime.Observe(float64(time.Since(start).Nanoseconds())) k.metrics.StartAddAddressBookOverlaysTime.Observe(float64(time.Since(start).Nanoseconds()))
}() }()
// trigger the first manage loop immediately so that
// we can start connecting to the bootnode quickly
k.notifyManageLoop()
return nil return nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment