You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2016/11/14 21:59:13 UTC
[3/6] incubator-trafficcontrol git commit: Fix TM2 to Stop time.Ticker
Fix TM2 to Stop time.Ticker
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/524f9173
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/524f9173
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/524f9173
Branch: refs/heads/psql-rebase
Commit: 524f9173ea5fd472473a84b89ac14d8868d1afd5
Parents: 968c13c
Author: Robert Butts <ro...@gmail.com>
Authored: Wed Nov 9 15:21:11 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Nov 14 14:56:11 2016 -0700
----------------------------------------------------------------------
traffic_monitor/experimental/common/poller/poller.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/524f9173/traffic_monitor/experimental/common/poller/poller.go
----------------------------------------------------------------------
diff --git a/traffic_monitor/experimental/common/poller/poller.go b/traffic_monitor/experimental/common/poller/poller.go
index c1a98fb..e8e401a 100644
--- a/traffic_monitor/experimental/common/poller/poller.go
+++ b/traffic_monitor/experimental/common/poller/poller.go
@@ -8,9 +8,9 @@ package poller
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,6 @@ package poller
* under the License.
*/
-
import (
"io/ioutil"
"math/rand"
@@ -263,6 +262,7 @@ func pollHttp(interval time.Duration, id string, url string, fetcher fetcher.Fet
for {
select {
case now := <-tick.C:
+ tick.Stop() // old ticker MUST call Stop() to release resources. Else, memory leak.
tick = time.NewTicker(interval) // recreate timer, to avoid Go's "smoothing" nonsense
realInterval := now.Sub(lastTime)
if realInterval > interval+(time.Millisecond*100) {