mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
rpc, eth/filters: use non-blocking timer drain pattern
This commit is contained in:
parent
d11e9c0b51
commit
ff6c6d4a92
2 changed files with 8 additions and 2 deletions
|
|
@ -435,7 +435,10 @@ func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
|
||||||
if !f.deadline.Stop() {
|
if !f.deadline.Stop() {
|
||||||
// timer expired but filter is not yet removed in timeout loop
|
// timer expired but filter is not yet removed in timeout loop
|
||||||
// receive timer value and reset timer
|
// receive timer value and reset timer
|
||||||
<-f.deadline.C
|
select {
|
||||||
|
case <-f.deadline.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
f.deadline.Reset(api.timeout)
|
f.deadline.Reset(api.timeout)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,7 +357,10 @@ func (wc *websocketCodec) pingLoop() {
|
||||||
|
|
||||||
case <-wc.pingReset:
|
case <-wc.pingReset:
|
||||||
if !pingTimer.Stop() {
|
if !pingTimer.Stop() {
|
||||||
<-pingTimer.C
|
select {
|
||||||
|
case <-pingTimer.C:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pingTimer.Reset(wsPingInterval)
|
pingTimer.Reset(wsPingInterval)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue