Skip to content

Commit

Permalink
1.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dankinsoid committed Apr 13, 2024
1 parent c5898e3 commit f94dd2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 85 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.7.9")
.package(url: "https://github.com/dankinsoid/swift-api-client.git", from: "1.7.10")
],
targets: [
.target(
Expand Down
71 changes: 0 additions & 71 deletions Sources/SwiftAPIClient/Utils/RuntimeWarnings.swift

This file was deleted.

26 changes: 13 additions & 13 deletions Sources/SwiftAPIClient/Utils/WithSynchronizedAccess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public func withThrowingSynchronizedAccess<T, ID: Hashable>(
} else if let task = cached as? Task<T, Never> {
return await task.value
} else {
runtimeWarn("Unexpected task type found in the barrier.")
// runtimeWarn("Unexpected task type found in the barrier.")
}
}
let task = Task(operation: task)
Expand Down Expand Up @@ -57,14 +57,14 @@ public func withSynchronizedAccess<T, ID: Hashable>(
) async -> T {
if let cached = await Barriers.shared.tasks[taskIdentifier] {
if let task = cached as? Task<T, Error> {
runtimeWarn("Attempted to access a throwing synchronized task from a non-throwing context.")
// logger("Attempted to access a throwing synchronized task from a non-throwing context.")
if let result = try? await task.value {
return result
}
} else if let task = cached as? Task<T, Never> {
return await task.value
} else {
runtimeWarn("Unexpected task type found in the barrier.")
// runtimeWarn("Unexpected task type found in the barrier.")
}
}
let task = Task(operation: task)
Expand Down Expand Up @@ -96,11 +96,11 @@ public func waitForThrowingSynchronizedAccess<ID: Hashable, T>(id taskIdentifier
guard let cached = await Barriers.shared.tasks[taskIdentifier] else {
return nil
}
let result = try await cached.wait() as? T
if result == nil, !(type is Void.Type) {
runtimeWarn("Unexpected task type found in the waitForThrowingSynchronizedAccess.")
}
return result
return try await cached.wait() as? T
// if result == nil, !(type is Void.Type) {
// runtimeWarn("Unexpected task type found in the waitForThrowingSynchronizedAccess.")
// }
// return result
}

/// Waits for the completion of all synchronized accesses associated with a specific identifier before proceeding.
Expand All @@ -124,11 +124,11 @@ public func waitForSynchronizedAccess<ID: Hashable, T>(id taskIdentifier: ID, of
return nil
}
do {
let result = try await cached.wait() as? T
if result == nil, !(type is Void.Type) {
runtimeWarn("Unexpected task type found in the waitForThrowingSynchronizedAccess.")
}
return result
return try await cached.wait() as? T
// if result == nil, !(type is Void.Type) {
// runtimeWarn("Unexpected task type found in the waitForThrowingSynchronizedAccess.")
// }
// return result
} catch {
return nil
}
Expand Down

0 comments on commit f94dd2d

Please sign in to comment.