mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 12:07:17 +00:00
92db317e06
Observer crawls the Ethereum network and collects information about the nodes.
16 lines
236 B
Go
16 lines
236 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
func Sleep(parentContext context.Context, timeout time.Duration) {
|
|
if timeout <= 0 {
|
|
return
|
|
}
|
|
ctx, cancel := context.WithTimeout(parentContext, timeout)
|
|
defer cancel()
|
|
<-ctx.Done()
|
|
}
|