Start sync loops only if -sync=true

pull/1/head
Martin Boehm 2018-02-02 16:17:33 +01:00
parent cf15f0cf0c
commit ac5aa2a234
1 changed files with 9 additions and 8 deletions

View File

@ -116,12 +116,11 @@ func main() {
if err := resyncIndex(); err != nil {
glog.Fatal("resyncIndex ", err)
}
go syncIndexLoop()
go syncMempoolLoop()
chanSyncMempool <- struct{}{}
}
go syncIndexLoop()
go syncMempoolLoop()
chanSyncMempool <- struct{}{}
var httpServer *server.HTTPServer
if *httpServerBinding != "" {
httpServer, err = server.NewHTTPServer(*httpServerBinding, index, mempool)
@ -184,10 +183,12 @@ func main() {
waitForSignalAndShutdown(httpServer, mq, 5*time.Second)
}
close(chanSyncIndex)
close(chanSyncMempool)
<-chanSyncIndexDone
<-chanSyncMempoolDone
if *synchronize {
close(chanSyncIndex)
close(chanSyncMempool)
<-chanSyncIndexDone
<-chanSyncMempoolDone
}
}
func tickAndDebounce(tickTime time.Duration, debounceTime time.Duration, input chan struct{}, f func()) {