From 6611d92e218d2ee76331497753a139d5d776c010 Mon Sep 17 00:00:00 2001 From: Marco Paganini Date: Wed, 4 Jan 2017 19:03:49 -0800 Subject: [PATCH] Only start bandwidth ticker when necessary. - Only start the token ticker when the timetable entry has more than one entry. - This fixes the "Scheduled bandwidth change" log message when no bwlimit is specified. - Fixes #987 --- fs/accounting.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/accounting.go b/fs/accounting.go index 5f6b18b21..4b9475048 100644 --- a/fs/accounting.go +++ b/fs/accounting.go @@ -43,6 +43,12 @@ func startTokenBucket() { // startTokenTicker creates a ticker to update the bandwidth limiter every minute. func startTokenTicker() { + // If the timetable has a single entry or was not specified, we don't need + // a ticker to update the bandwidth. + if len(bwLimit) <= 1 { + return + } + ticker := time.NewTicker(time.Minute) go func() { for range ticker.C {