forked from cerc-io/plugeth
core/rawdb: fix leak of backoff timer (#25776)
This commit is contained in:
parent
57a65f00c9
commit
83989a19be
@ -92,6 +92,8 @@ func (f *chainFreezer) freeze(db ethdb.KeyValueStore) {
|
|||||||
backoff bool
|
backoff bool
|
||||||
triggered chan struct{} // Used in tests
|
triggered chan struct{} // Used in tests
|
||||||
)
|
)
|
||||||
|
timer := time.NewTimer(freezerRecheckInterval)
|
||||||
|
defer timer.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-f.quit:
|
case <-f.quit:
|
||||||
@ -106,8 +108,9 @@ func (f *chainFreezer) freeze(db ethdb.KeyValueStore) {
|
|||||||
triggered = nil
|
triggered = nil
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case <-time.NewTimer(freezerRecheckInterval).C:
|
case <-timer.C:
|
||||||
backoff = false
|
backoff = false
|
||||||
|
timer.Reset(freezerRecheckInterval)
|
||||||
case triggered = <-f.trigger:
|
case triggered = <-f.trigger:
|
||||||
backoff = false
|
backoff = false
|
||||||
case <-f.quit:
|
case <-f.quit:
|
||||||
|
Loading…
Reference in New Issue
Block a user