Skip to content

Commit 34b8544

Browse files
committed
Got rid of cancellation state as we can use .buffer([])
1 parent 2c8529f commit 34b8544

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

Sources/AWSLambdaRuntime/Lambda+LocalServer.swift

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ internal struct LambdaHTTPServer {
440440
enum State: ~Copyable {
441441
case buffer(Deque<T>)
442442
case continuation(CheckedContinuation<T, any Error>?)
443-
case cancelled
444443
}
445444

446445
private let lock = Mutex<State>(.buffer([]))
@@ -459,10 +458,6 @@ internal struct LambdaHTTPServer {
459458
buffer.append(invocation)
460459
state = .buffer(buffer)
461460
return nil
462-
463-
case .cancelled:
464-
state = .cancelled
465-
return nil
466461
}
467462
}
468463

@@ -490,10 +485,6 @@ internal struct LambdaHTTPServer {
490485

491486
case .continuation:
492487
fatalError("Concurrent invocations to next(). This is illegal.")
493-
494-
case .cancelled:
495-
state = .cancelled
496-
return nil
497488
}
498489
}
499490

@@ -508,9 +499,7 @@ internal struct LambdaHTTPServer {
508499
state = .buffer(buffer)
509500
case .continuation(let continuation):
510501
continuation?.resume(throwing: CancellationError())
511-
state = .continuation(continuation)
512-
case .cancelled:
513-
state = .cancelled
502+
state = .buffer([])
514503
}
515504
}
516505
}

0 commit comments

Comments
 (0)