From 502226bfc8c681e556eabbcd88d5c6e695b6434b Mon Sep 17 00:00:00 2001 From: Ovidiu Victor Tatar Date: Thu, 7 Jul 2022 19:58:21 +0200 Subject: [PATCH] pacer: add ZeroDelayCalculator --- lib/pacer/pacers.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/pacer/pacers.go b/lib/pacer/pacers.go index d510eea64..94ef86ccb 100644 --- a/lib/pacer/pacers.go +++ b/lib/pacer/pacers.go @@ -104,6 +104,15 @@ func (c *Default) Calculate(state State) time.Duration { return sleepTime } +// ZeroDelayCalculator is a Calculator that never delays. +type ZeroDelayCalculator struct { +} + +// Calculate takes the current Pacer state and return the wait time until the next try. +func (c *ZeroDelayCalculator) Calculate(state State) time.Duration { + return 0 +} + // AmazonCloudDrive is a specialized pacer for Amazon Drive // // It implements a truncated exponential backoff strategy with randomization.