Skip to content

Commit

Permalink
retry bootstrap peer any time we dont have any peers (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender authored Sep 10, 2024
1 parent 882a1c3 commit 1fcbc69
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/crawl.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,17 @@ var crawlCmd = &cobra.Command{
hostTimestampsLock.Unlock()

if len(crawling) == 0 {
log.Printf("No new peers to crawl (%d too recent). Sleeping for 1 minute...", len(skippingTooRecent))
stats()
time.Sleep(1 * time.Minute)
continue
if len(skippingTooRecent) == 0 {
// No crawling and none too recent means none at all
// Try bootstrap again
log.Println("No peers, checking bootstrap peer")
crawling = append(crawling, initialHost)
} else {
log.Printf("No new peers to crawl (%d too recent). Sleeping for 1 minute...", len(skippingTooRecent))
stats()
time.Sleep(1 * time.Minute)
continue
}
}
// Setup progress bar
bar := progressbar.Default(int64(len(crawling)))
Expand Down

0 comments on commit 1fcbc69

Please sign in to comment.