Start sync loops only if -sync=true

This commit is contained in:
Martin Boehm 2018-02-02 16:17:33 +01:00
parent cf15f0cf0c
commit ac5aa2a234

View File

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