Skip to content

Commit 6d18dfb

Browse files
committed
Fix CI: remove automatic checkReachability from connect(), make it public opt-in
1 parent 580e90a commit 6d18dfb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Sources/SQLClientSwift/SQLClient.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,8 @@ public actor SQLClient {
138138
try await connect(options: SQLClientConnectionOptions(server: server, username: username, password: password, database: database))
139139
}
140140

141-
public func connect(options: SQLClientConnectionOptions) async throws {
142-
guard !connected else { throw SQLClientError.alreadyConnected }
143-
144-
try await checkReachability(server: options.server, port: options.port ?? 1433)
141+
public func connect(options: SQLClientConnectionOptions) async throws {
142+
guard !connected else { throw SQLClientError.alreadyConnected }
145143

146144
let result = try await runBlocking {
147145
return try self._connectSync(options: options)
@@ -194,9 +192,12 @@ public actor SQLClient {
194192

195193
// MARK: - Synchronous Helpers
196194

197-
// try await checkReachability(server: options.server, port: options.port ?? 1433)
195+
// MARK: - Reachability
198196

199-
private func checkReachability(server: String, port: UInt16) async throws {
197+
/// Optional pre-flight TCP check. Call this before connect() if you want
198+
/// to fail fast with a clear error instead of waiting for FreeTDS to time out.
199+
/// Not called automatically — integrate tests and CI skip it safely this way.
200+
public func checkReachability(server: String, port: UInt16 = 1433) async throws {
200201
try await withCheckedThrowingContinuation { (cont: CheckedContinuation<Void, Error>) in
201202
Thread.detachNewThread {
202203
var readStream: Unmanaged<CFReadStream>?

0 commit comments

Comments
 (0)