@@ -69,7 +69,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
69
69
70
70
private enum ConnectionState : Equatable {
71
71
case disconnected
72
- case lostConnection
73
72
case connecting( [ ConnectionContinuation ] )
74
73
case connected( Channel , LambdaChannelHandler < LambdaRuntimeClient > )
75
74
@@ -81,8 +80,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
81
80
return true
82
81
case ( . connected, . connected) :
83
82
return true
84
- case ( . lostConnection, . lostConnection) :
85
- return true
86
83
default :
87
84
return false
88
85
}
@@ -171,21 +168,14 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
171
168
172
169
case . connected( let channel, _) :
173
170
channel. close ( mode: . all, promise: nil )
174
-
175
- case . lostConnection:
176
- continuation. resume ( )
177
171
}
178
172
}
179
173
}
180
174
181
175
@usableFromInline
182
176
func nextInvocation( ) async throws -> ( Invocation , Writer ) {
183
177
184
- if self . connectionState == . lostConnection {
185
- throw LambdaRuntimeError ( code: . connectionToControlPlaneLost)
186
- }
187
-
188
- return try await withTaskCancellationHandler {
178
+ try await withTaskCancellationHandler {
189
179
switch self . lambdaState {
190
180
case . idle:
191
181
self . lambdaState = . waitingForNextInvocation
@@ -285,7 +275,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
285
275
286
276
private func channelClosed( _ channel: any Channel ) {
287
277
switch ( self . connectionState, self . closingState) {
288
- case ( _, . closed) , ( . lostConnection , _ ) :
278
+ case ( _, . closed) :
289
279
fatalError ( " Invalid state: \( self . connectionState) , \( self . closingState) " )
290
280
291
281
case ( . disconnected, . notClosing) :
@@ -345,9 +335,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
345
335
return loopBound. value
346
336
case . connected( _, let handler) :
347
337
return handler
348
-
349
- case . lostConnection:
350
- throw LambdaRuntimeError ( code: . connectionToControlPlaneLost)
351
338
}
352
339
353
340
let bootstrap = ClientBootstrap ( group: self . eventLoop)
@@ -401,7 +388,7 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
401
388
402
389
// close the channel
403
390
runtimeClient. channelClosed ( channel)
404
- runtimeClient. connectionState = . lostConnection
391
+ runtimeClient. connectionState = . disconnected
405
392
}
406
393
}
407
394
@@ -418,9 +405,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
418
405
}
419
406
}
420
407
return handler
421
- case . lostConnection:
422
- // this should never happen
423
- fatalError ( " Lost connection to Lambda service " )
424
408
}
425
409
} catch {
426
410
@@ -436,9 +420,6 @@ final actor LambdaRuntimeClient: LambdaRuntimeClientProtocol {
436
420
}
437
421
}
438
422
throw error
439
- case . lostConnection:
440
- // this should never happen
441
- fatalError ( " Lost connection to Lambda service " )
442
423
}
443
424
}
444
425
}
@@ -475,10 +456,6 @@ extension LambdaRuntimeClient: LambdaChannelHandlerDelegate {
475
456
}
476
457
477
458
isolated. connectionState = . disconnected
478
-
479
- case . lostConnection:
480
- // this should never happen
481
- fatalError ( " Lost connection to Lambda service " )
482
459
}
483
460
}
484
461
}
0 commit comments