This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-swift.git
The following commit(s) were added to refs/heads/main by this push:
new 672a48c chore: Don't use synchronous methods in asynchronous contexts
(#56)
672a48c is described below
commit 672a48ce7e8d400ddb7fd2d3e8546362fa41c398
Author: Sutou Kouhei <[email protected]>
AuthorDate: Wed Jun 25 23:29:27 2025 +0900
chore: Don't use synchronous methods in asynchronous contexts (#56)
## What's Changed
Creates synchronous methods and call it in `defer` to free resources.
Closes #55.
---
.github/workflows/rc.yaml | 11 +++++++++--
.github/workflows/test.yaml | 2 --
ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift | 18 ++++++++++++++----
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/rc.yaml b/.github/workflows/rc.yaml
index 9702de8..f0eb36c 100644
--- a/.github/workflows/rc.yaml
+++ b/.github/workflows/rc.yaml
@@ -105,7 +105,14 @@ jobs:
- source
- target
runs-on: ubuntu-latest
- timeout-minutes: 45
+ timeout-minutes: 15
+ strategy:
+ fail-fast: false
+ matrix:
+ swift-version:
+ - "5.10"
+ - "6.0"
+ - "6.1"
env:
RC: ${{ needs.target.outputs.rc }}
VERSION: ${{ needs.target.outputs.version }}
@@ -115,7 +122,7 @@ jobs:
- name: Setup Swift
uses:
swift-actions/setup-swift@682457186b71c25a884c45c06f859febbe259240 # v2.3.0
with:
- swift-version: "5.10"
+ swift-version: ${{ matrix.swift-version }}
- name: Download
uses:
actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 1fd23c5..8be2584 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -86,8 +86,6 @@ jobs:
run: |
docker compose build ubuntu
- name: Run
- # We remove this when we support Swift 6.0 or later.
- continue-on-error: ${{ matrix.swift-version != '5.10' }}
run: |
docker compose run --rm ubuntu
- name: Fix permission for .docker/
diff --git a/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
b/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
index 33926cb..34ebe80 100644
--- a/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
+++ b/ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift
@@ -160,6 +160,10 @@ struct FlightServerImpl {
print("Unknown server error: \(error)")
}
}
+
+ static func syncShutdown() throws {
+ try group?.syncShutdownGracefully()
+ }
}
public class FlightClientTester {
@@ -179,9 +183,9 @@ public class FlightClientTester {
client = FlightClient(channel: channel)
}
- deinit {
- try? group?.syncShutdownGracefully()
- try? channel?.close().wait()
+ func syncShutdown() throws {
+ try group?.syncShutdownGracefully()
+ try channel?.close().wait()
}
func listActionTest() async throws {
@@ -319,7 +323,7 @@ final class FlightTest: XCTestCase {
defer {
print("server shutting down")
do {
- try FlightServerImpl.group?.syncShutdownGracefully()
+ try FlightServerImpl.syncShutdown()
} catch {
}
}
@@ -339,6 +343,12 @@ final class FlightTest: XCTestCase {
}
let clientImpl = try await FlightClientTester()
+ defer {
+ do {
+ try clientImpl.syncShutdown()
+ } catch {
+ }
+ }
try await clientImpl.listActionTest()
try await clientImpl.doPutTest("flight_ticket")
try await clientImpl.doPutTest("flight_another")