From 0545d9a5c2b7d0b558af7025ebb8de0fd32666e9 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Mon, 8 Feb 2016 21:03:21 +0000 Subject: [PATCH] Fix variable scope bug --- probe/endpoint/procspy/background_reader_linux.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/probe/endpoint/procspy/background_reader_linux.go b/probe/endpoint/procspy/background_reader_linux.go index a7225b3b6..6d4405175 100644 --- a/probe/endpoint/procspy/background_reader_linux.go +++ b/probe/endpoint/procspy/background_reader_linux.go @@ -58,6 +58,7 @@ func (br *backgroundReader) loop(walker process.Walker) { walkc chan map[uint64]*Proc // initially nil, i.e. off walkBuf = bytes.NewBuffer(make([]byte, 0, 5000)) rateLimitPeriod = initialRateLimitPeriod + nextInterval time.Duration ticker = time.NewTicker(rateLimitPeriod) pWalker = newPidWalker(walker, ticker.C, fdBlockSize) ) @@ -80,9 +81,9 @@ func (br *backgroundReader) loop(walker process.Walker) { // Schedule next walk and adjust rate limit walkTime := time.Since(begin) - rateLimitPeriod, nextInterval := scheduleNextWalk(rateLimitPeriod, walkTime) + rateLimitPeriod, nextInterval = scheduleNextWalk(rateLimitPeriod, walkTime) ticker.Stop() - ticker := time.NewTicker(rateLimitPeriod) + ticker = time.NewTicker(rateLimitPeriod) pWalker.ticker = ticker.C walkc = nil // turn off until the next loop