Skip to content

Commit

Permalink
1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Apr 7, 2024
1 parent 56e316a commit b186745
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ import PackageDescription
let package = Package(
name: "SomeProject",
dependencies: [
.package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "1.5.3")
.package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "1.5.4")
],
targets: [
.target(
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftAPIClient/Modifiers/TimeoutModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public extension APIClient {
self.timeout(
timeout,
seconds: { Double($0.components.seconds) + Double($0.components.attoseconds) * pow(10.0, -18.0) },
sleep: { try await clock.sleep(for: $0, tolerance: tolerance) },
sleep: { try await clock.sleep(until: clock.now.advanced(by: $0), tolerance: tolerance) },
fileID: fileID,
line: line
)
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftAPIClient/Types/TimeoutError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public func withTimeout<T, C: Clock>(
) async throws -> T where C.Duration == Duration {
try await withTimeout(
timeout,
seconds: { Double($0.components.seconds) + Double($0.components.attoseconds) * pow(10, -18) },
sleep: { try await clock.sleep(for: $0, tolerance: tolerance) },
seconds: { Double($0.components.seconds) + (Double($0.components.attoseconds) * pow(10, -18)) },
sleep: { try await clock.sleep(until: clock.now.advanced(by: $0), tolerance: tolerance) },
fileID: fileID,
line: line,
operation: operation
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftAPIClientTests/UtilsTests/WithTimeoutTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class WithTimeoutTests: XCTestCase {
func test_withTimeout_timeout() async {
do {
_ = try await withTimeout(.nanoseconds(2)) {
try await Task.sleep(for: .milliseconds(4))
try await Task.sleep(until: .now.advanced(by: .milliseconds(4)))
return 42
}
XCTFail("Expected timeout error")
Expand All @@ -33,7 +33,7 @@ class WithTimeoutTests: XCTestCase {

func test_withTimeout_success() async throws {
_ = try await withTimeout(.milliseconds(4)) {
try await Task.sleep(for: .nanoseconds(2))
try await Task.sleep(until: .now.advanced(by: .nanoseconds(2)))
return 42
}
}
Expand Down

0 comments on commit b186745

Please sign in to comment.