Commit b90c7a55 by Julien Pivotto

Simplify logic

Signed-off-by: 's avatarJulien Pivotto <roidelapluie@inuits.eu>
parent ccc1df31
......@@ -990,8 +990,8 @@ func (sl *scrapeLoop) run(interval, timeout time.Duration, errc chan<- error) {
var last time.Time
ticker := time.NewTicker(interval)
alignedScrapeTime := time.Now()
ticker := time.NewTicker(interval)
defer ticker.Stop()
mainLoop:
......@@ -1016,7 +1016,7 @@ mainLoop:
alignedScrapeTime = alignedScrapeTime.Add(interval)
}
// Align the scrape time if we are in the tolerance boundaries.
if t := scrapeTime.Sub(alignedScrapeTime); t >= -scrapeTimestampTolerance && t <= scrapeTimestampTolerance {
if scrapeTime.Sub(alignedScrapeTime) <= scrapeTimestampTolerance {
scrapeTime = alignedScrapeTime
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment