discovery/sync_manager: break out IsGraphSynced check

This commit is contained in:
Conner Fromknecht 2021-01-29 00:13:05 -08:00
parent 7c6aa20bd8
commit 72fbd1283b
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

View File

@ -380,12 +380,16 @@ func (m *SyncManager) syncerHandler() {
// Our HistoricalSyncTicker has ticked, so we'll randomly select
// a peer and force a historical sync with them.
case <-m.cfg.HistoricalSyncTicker.Ticks():
// If we don't have a syncer available we have nothing
// to do.
s := m.forceHistoricalSync()
if s == nil {
continue
}
// If we don't have a syncer available or we've already
// performed our initial historical sync, then we have
// nothing left to do.
if s == nil || m.IsGraphSynced() {
// If we've already completed a historical sync, we'll
// skip setting the initial historical syncer.
if m.IsGraphSynced() {
continue
}