mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
rename wg to startupWG
This commit is contained in:
parent
6a6bdab463
commit
6d6183762c
2 changed files with 13 additions and 14 deletions
|
|
@ -220,7 +220,7 @@ func (ac *accountCache) maybeReload() {
|
||||||
ac.watcher.start()
|
ac.watcher.start()
|
||||||
ac.throttle.Reset(minReloadInterval)
|
ac.throttle.Reset(minReloadInterval)
|
||||||
ac.mu.Unlock()
|
ac.mu.Unlock()
|
||||||
ac.watcher.wg.Wait()
|
ac.watcher.startupWG.Wait()
|
||||||
ac.scanAccounts()
|
ac.scanAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,19 +29,19 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type watcher struct {
|
type watcher struct {
|
||||||
ac *accountCache
|
ac *accountCache
|
||||||
running bool // set to true when runloop begins
|
running bool // set to true when runloop begins
|
||||||
runEnded bool // set to true when runloop ends
|
runEnded bool // set to true when runloop ends
|
||||||
starting bool // set to true prior to runloop starting
|
starting bool // set to true prior to runloop starting
|
||||||
quit chan struct{}
|
quit chan struct{}
|
||||||
wg sync.WaitGroup // wait for watcher loop to start
|
startupWG sync.WaitGroup // wait for watcher loop to start
|
||||||
}
|
}
|
||||||
|
|
||||||
func newWatcher(ac *accountCache) *watcher {
|
func newWatcher(ac *accountCache) *watcher {
|
||||||
return &watcher{
|
return &watcher{
|
||||||
ac: ac,
|
ac: ac,
|
||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
wg: sync.WaitGroup{},
|
startupWG: sync.WaitGroup{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ func (w *watcher) start() {
|
||||||
if w.starting || w.running {
|
if w.starting || w.running {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.wg.Add(1)
|
w.startupWG.Add(1)
|
||||||
w.starting = true
|
w.starting = true
|
||||||
go w.loop()
|
go w.loop()
|
||||||
}
|
}
|
||||||
|
|
@ -81,12 +81,11 @@ func (w *watcher) loop() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer watcher.Close()
|
defer watcher.Close()
|
||||||
|
|
||||||
if err := watcher.Add(w.ac.keydir); err != nil {
|
if err := watcher.Add(w.ac.keydir); err != nil {
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
logger.Warn("Failed to watch keystore folder", "err", err)
|
logger.Warn("Failed to watch keystore folder", "err", err)
|
||||||
}
|
}
|
||||||
w.wg.Done()
|
w.startupWG.Done()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +109,7 @@ func (w *watcher) loop() {
|
||||||
<-debounce.C
|
<-debounce.C
|
||||||
}
|
}
|
||||||
defer debounce.Stop()
|
defer debounce.Stop()
|
||||||
w.wg.Done()
|
w.startupWG.Done()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-w.quit:
|
case <-w.quit:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue