From 73e32468d58befed13cbb30654b1aa8db9be59e7 Mon Sep 17 00:00:00 2001 From: Lyndsay Roger Date: Thu, 1 Oct 2015 10:49:25 +1300 Subject: [PATCH] Migrate seeder init to goroutine --- main.go | 1 - seeder.go | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 7f69273..176f0ab 100644 --- a/main.go +++ b/main.go @@ -122,7 +122,6 @@ func main() { done := make(chan struct{}) // start a goroutine for each seeder for _, s := range config.seeders { - s.initCrawlers() wg.Add(1) go s.runSeeder(done, &wg) } diff --git a/seeder.go b/seeder.go index 4d93801..cbcdd31 100644 --- a/seeder.go +++ b/seeder.go @@ -128,14 +128,15 @@ func (s *dnsseeder) runSeeder(done <-chan struct{}, wg *sync.WaitGroup) { // receive the results from the crawl goroutines resultsChan := make(chan *result) - // start initial scan now + // load data from other seeders so we can start crawling nodes + s.initCrawlers() + + // start initial scan now so we don't have to wait for the timers to fire s.startCrawlers(resultsChan) - // used to cleanout and cycle records in theList + // create timing channels for regular tasks auditChan := time.NewTicker(time.Minute * auditDelay).C - // used to start crawlers on a regular basis crawlChan := time.NewTicker(time.Second * crawlDelay).C - // extract good dns records from all nodes on regular basis dnsChan := time.NewTicker(time.Second * dnsDelay).C dowhile := true