@@ -45,10 +45,10 @@ private import Synchronization
45
45
/// ## Creating a client manually
46
46
///
47
47
/// If the `with`-style methods for creating clients isn't suitable for your application then you
48
- /// can create and run a client manually. This requires you to call the ``maintainConnections ()`` method in a task
48
+ /// can create and run a client manually. This requires you to call the ``runConnections ()`` method in a task
49
49
/// which instructs the client to start connecting to the server.
50
50
///
51
- /// The ``maintainConnections ()`` method won't return until the client has finished handling all requests. You can
51
+ /// The ``runConnections ()`` method won't return until the client has finished handling all requests. You can
52
52
/// signal to the client that it should stop creating new request streams by calling ``beginGracefulShutdown()``.
53
53
/// This gives the client enough time to drain any requests already in flight. To stop the client
54
54
/// more abruptly you can cancel the task running your client. If your application requires
@@ -114,7 +114,7 @@ public final class GRPCClient: Sendable {
114
114
func checkExecutable( ) throws {
115
115
switch self {
116
116
case . notStarted, . running:
117
- // Allow .notStarted as making a request can race with 'maintainConnections ()'. Transports should tolerate
117
+ // Allow .notStarted as making a request can race with 'runConnections ()'. Transports should tolerate
118
118
// queuing the request if not yet started.
119
119
( )
120
120
case . stopping, . stopped:
@@ -208,7 +208,7 @@ public final class GRPCClient: Sendable {
208
208
///
209
209
/// The client, and by extension this function, can only be run once. If the client is already
210
210
/// running or has already been closed then a ``RuntimeError`` is thrown.
211
- public func maintainConnections ( ) async throws {
211
+ public func runConnections ( ) async throws {
212
212
try self . stateMachine. withLock { try $0. state. run ( ) }
213
213
214
214
// When this function exits the client must have stopped.
@@ -227,9 +227,9 @@ public final class GRPCClient: Sendable {
227
227
}
228
228
}
229
229
230
- @available ( * , deprecated, renamed: " maintainConnections " , message: " It'll be removed before v2. " )
230
+ @available ( * , deprecated, renamed: " runConnections " , message: " It'll be removed before v2. " )
231
231
public func run( ) async throws {
232
- try await self . maintainConnections ( )
232
+ try await self . runConnections ( )
233
233
}
234
234
235
235
/// Close the client.
@@ -343,7 +343,7 @@ public final class GRPCClient: Sendable {
343
343
344
344
/// Start a bidirectional streaming RPC.
345
345
///
346
- /// - Note: ``maintainConnections ()`` must have been called and still executing, and ``beginGracefulShutdown()`` mustn't
346
+ /// - Note: ``runConnections ()`` must have been called and still executing, and ``beginGracefulShutdown()`` mustn't
347
347
/// have been called.
348
348
///
349
349
/// - Parameters:
@@ -435,7 +435,7 @@ public func withGRPCClient<Result: Sendable>(
435
435
try await withThrowingDiscardingTaskGroup { group in
436
436
let client = GRPCClient ( transport: transport, interceptorPipeline: interceptorPipeline)
437
437
group. addTask {
438
- try await client. maintainConnections ( )
438
+ try await client. runConnections ( )
439
439
}
440
440
441
441
let result = try await handleClient ( client)
0 commit comments