good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 5435e0d1 authored by ucwong's avatar ucwong Committed by GitHub
Browse files

whisper : use timer.Ticker instead of sleep (#21240)


* whisper : use timer.Ticker instead of sleep

* lint: Fix linter error

Co-authored-by: default avatarGuillaume Ballet <gballet@gmail.com>
parent e029cc66
No related branches found
No related tags found
No related merge requests found
......@@ -249,7 +249,10 @@ func (whisper *Whisper) SetBloomFilter(bloom []byte) error {
go func() {
// allow some time before all the peers have processed the notification
defer whisper.wg.Done()
time.Sleep(time.Duration(whisper.syncAllowance) * time.Second)
ticker := time.NewTicker(time.Duration(whisper.syncAllowance) * time.Second)
defer ticker.Stop()
<-ticker.C
whisper.settings.Store(bloomFilterToleranceIdx, b)
}()
......@@ -269,7 +272,10 @@ func (whisper *Whisper) SetMinimumPoW(val float64) error {
go func() {
defer whisper.wg.Done()
// allow some time before all the peers have processed the notification
time.Sleep(time.Duration(whisper.syncAllowance) * time.Second)
ticker := time.NewTicker(time.Duration(whisper.syncAllowance) * time.Second)
defer ticker.Stop()
<-ticker.C
whisper.settings.Store(minPowToleranceIdx, val)
}()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment