Skip to content

Commit

Permalink
333: Resolve swiftlint warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Seay <[email protected]>
  • Loading branch information
eseay committed Feb 5, 2025
1 parent ccfb544 commit b6b2ddd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
run-swiftlint:
runs-on: ubuntu-latest
container:
image: ghcr.io/realm/swiftlint:0.57.1
image: ghcr.io/realm/swiftlint:0.58.2
steps:
- uses: actions/checkout@v4
- name: Run SwiftLint
Expand Down
13 changes: 9 additions & 4 deletions Libraries/Connect/Internal/Unary/UnaryAsyncWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwiftProtobuf
/// https://forums.swift.org/t/how-to-use-withtaskcancellationhandler-properly/54341/37
/// https://stackoverflow.com/q/71898080
@available(iOS 13, *)
actor UnaryAsyncWrapper<Output: ProtobufMessage>: Sendable {
actor UnaryAsyncWrapper<Output: ProtobufMessage> {
private var cancelable: Cancelable?
private let sendUnary: PerformClosure

Expand All @@ -44,7 +44,12 @@ actor UnaryAsyncWrapper<Output: ProtobufMessage>: Sendable {
await withTaskCancellationHandler {
await withCheckedContinuation { continuation in
guard !Task.isCancelled else {
continuation.resume(returning: .init(code: .canceled, result: .failure(.canceled())))
continuation.resume(
returning: ResponseMessage(
code: .canceled,
result: .failure(.canceled())
)
)
return
}

Expand All @@ -58,8 +63,8 @@ actor UnaryAsyncWrapper<Output: ProtobufMessage>: Sendable {
}
}
} onCancel: {
// When `Task.cancel` signals for this function to be canceled, the underlying function will be canceled
// as well.
// When `Task.cancel` signals for this function to be canceled,
// the underlying function will be canceled as well.
Task(priority: .high) {
await self.cancelable?.cancel()
}
Expand Down

0 comments on commit b6b2ddd

Please sign in to comment.