Browse Source

accounts/keystore: Ignore initial trigger of rescan-event

Martin Holst Swende 8 years ago
parent
commit
e2b3a23663
1 changed files with 5 additions and 1 deletions
  1. 5 1
      accounts/keystore/watch.go

+ 5 - 1
accounts/keystore/watch.go

@@ -81,10 +81,14 @@ func (w *watcher) loop() {
 	// When an event occurs, the reload call is delayed a bit so that
 	// multiple events arriving quickly only cause a single reload.
 	var (
-		debounce         = time.NewTimer(0)
 		debounceDuration = 500 * time.Millisecond
 		rescanTriggered  = false
+		debounce         = time.NewTimer(0)
 	)
+	// Ignore initial trigger
+	if !debounce.Stop() {
+		<-debounce.C
+	}
 	defer debounce.Stop()
 	for {
 		select {