discovery: handle graph synced status after stalled initial historical sync

This ensures that the graph synced status is marked true at some point
once a historical sync has completed. Before this commit, a stalled
historical sync could cause us to never mark the graph as synced.
This commit is contained in:
Wilmer Paulino committed 2019-08-06 17:56:55 -07:00
1 parent af4234f680
commit 977c139f3c
2 files changed
+67 -1

No files matched your search

+15 -1
View File
@@ -381,7 +381,21 @@ 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():
m.forceHistoricalSync()
s := m.forceHistoricalSync()
// If we've already performed our initial historical
// sync, then we have nothing left to do.
if m.IsGraphSynced() {
continue
}
// Otherwise, we'll track the peer we've performed a
// historical sync with in order to handle the case
// where our previous historical sync peer did not
// respond to our queries and we haven't ingested as
// much of the graph as we should.
initialHistoricalSyncer = s
initialHistoricalSyncSignal = s.ResetSyncedSignal()
case <-m.quit:
return