Skip to content

Commit 672a48c

Browse files
authored
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.
1 parent 4593bae commit 672a48c

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

.github/workflows/rc.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ jobs:
105105
- source
106106
- target
107107
runs-on: ubuntu-latest
108-
timeout-minutes: 45
108+
timeout-minutes: 15
109+
strategy:
110+
fail-fast: false
111+
matrix:
112+
swift-version:
113+
- "5.10"
114+
- "6.0"
115+
- "6.1"
109116
env:
110117
RC: ${{ needs.target.outputs.rc }}
111118
VERSION: ${{ needs.target.outputs.version }}
@@ -115,7 +122,7 @@ jobs:
115122
- name: Setup Swift
116123
uses: swift-actions/setup-swift@682457186b71c25a884c45c06f859febbe259240 # v2.3.0
117124
with:
118-
swift-version: "5.10"
125+
swift-version: ${{ matrix.swift-version }}
119126
- name: Download
120127
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
121128
with:

.github/workflows/test.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ jobs:
8686
run: |
8787
docker compose build ubuntu
8888
- name: Run
89-
# We remove this when we support Swift 6.0 or later.
90-
continue-on-error: ${{ matrix.swift-version != '5.10' }}
9189
run: |
9290
docker compose run --rm ubuntu
9391
- name: Fix permission for .docker/

ArrowFlight/Tests/ArrowFlightTests/FlightTest.swift

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ struct FlightServerImpl {
160160
print("Unknown server error: \(error)")
161161
}
162162
}
163+
164+
static func syncShutdown() throws {
165+
try group?.syncShutdownGracefully()
166+
}
163167
}
164168

165169
public class FlightClientTester {
@@ -179,9 +183,9 @@ public class FlightClientTester {
179183
client = FlightClient(channel: channel)
180184
}
181185

182-
deinit {
183-
try? group?.syncShutdownGracefully()
184-
try? channel?.close().wait()
186+
func syncShutdown() throws {
187+
try group?.syncShutdownGracefully()
188+
try channel?.close().wait()
185189
}
186190

187191
func listActionTest() async throws {
@@ -319,7 +323,7 @@ final class FlightTest: XCTestCase {
319323
defer {
320324
print("server shutting down")
321325
do {
322-
try FlightServerImpl.group?.syncShutdownGracefully()
326+
try FlightServerImpl.syncShutdown()
323327
} catch {
324328
}
325329
}
@@ -339,6 +343,12 @@ final class FlightTest: XCTestCase {
339343
}
340344

341345
let clientImpl = try await FlightClientTester()
346+
defer {
347+
do {
348+
try clientImpl.syncShutdown()
349+
} catch {
350+
}
351+
}
342352
try await clientImpl.listActionTest()
343353
try await clientImpl.doPutTest("flight_ticket")
344354
try await clientImpl.doPutTest("flight_another")

0 commit comments

Comments
 (0)