From 6a64633f43c04f38c270ed344a698819307aaa92 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Sun, 24 Sep 2023 19:26:10 +0100 Subject: [PATCH] Fix 5.7/5.8 build errors # Motivation Currently, this repo fails to build on Swift 5.7 and 5.8 since we were using clock APIs that were only available on 5.9. --- Sources/AsyncAlgorithms/AsyncThrottleSequence.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift b/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift index a8eec469..f515fe6a 100644 --- a/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncThrottleSequence.swift @@ -85,7 +85,7 @@ extension AsyncThrottleSequence: AsyncSequence { // ensure the rate of elements never exceeds the given interval let amount = interval - last.duration(to: clock.now) if amount > .zero { - try? await clock.sleep(for: amount) + try? await clock.sleep(until: clock.now.advanced(by: amount), tolerance: nil) } } // the last value is unable to have any subsequent