mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
Update opentsdb.go
This commit is contained in:
parent
1e4b39ed12
commit
b96bece193
1 changed files with 3 additions and 1 deletions
|
|
@ -39,7 +39,9 @@ func OpenTSDB(r Registry, d time.Duration, prefix string, addr *net.TCPAddr) {
|
||||||
// OpenTSDBWithConfig is a blocking exporter function just like OpenTSDB,
|
// OpenTSDBWithConfig is a blocking exporter function just like OpenTSDB,
|
||||||
// but it takes a OpenTSDBConfig instead.
|
// but it takes a OpenTSDBConfig instead.
|
||||||
func OpenTSDBWithConfig(c OpenTSDBConfig) {
|
func OpenTSDBWithConfig(c OpenTSDBConfig) {
|
||||||
for range time.Tick(c.FlushInterval) {
|
ticker := time.NewTicker(c.FlushInterval)
|
||||||
|
defer ticker.Stop() // Use NewTicker to allow explicit stop and avoid leaked timers.
|
||||||
|
for range ticker.C {
|
||||||
if err := openTSDB(&c); nil != err {
|
if err := openTSDB(&c); nil != err {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue