Skip to content

Commit 86548c1

Browse files
committed
swift-format
1 parent 207905c commit 86548c1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

Sources/AWSLambdaRuntimeCore/Lambda+LocalServer.swift

+15-9
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private struct LambdaHTTPServer {
104104
invocationEndpoint: String?,
105105
host: String = "127.0.0.1",
106106
port: Int = 7000,
107-
eventLoopGroup: MultiThreadedEventLoopGroup = .singleton,
107+
eventLoopGroup: MultiThreadedEventLoopGroup = .singleton,
108108
logger: Logger,
109109
_ closure: sending @escaping () async throws -> Result
110110
) async throws -> Result {
@@ -145,7 +145,8 @@ private struct LambdaHTTPServer {
145145
// Sadly the Swift compiler does not understand that the passed in closure will only be
146146
// invoked once. Because of this we need an unsafe transfer box here. Buuuh!
147147
let closureBox = UnsafeTransferBox(value: closure)
148-
let result = await withTaskGroup(of: TaskResult<Result>.self, returning: Swift.Result<Result, any Error>.self) { group in
148+
let result = await withTaskGroup(of: TaskResult<Result>.self, returning: Swift.Result<Result, any Error>.self) {
149+
group in
149150
group.addTask {
150151
let c = closureBox.value
151152
do {
@@ -196,9 +197,12 @@ private struct LambdaHTTPServer {
196197
return result
197198

198199
case .serverReturned(let result):
199-
logger.error("Server shutdown before closure completed", metadata: [
200-
"error": "\(result.maybeError != nil ? "\(result.maybeError!)" : "none")"
201-
])
200+
logger.error(
201+
"Server shutdown before closure completed",
202+
metadata: [
203+
"error": "\(result.maybeError != nil ? "\(result.maybeError!)" : "none")"
204+
]
205+
)
202206
switch await group.next()! {
203207
case .closureResult(let result):
204208
return result
@@ -213,8 +217,6 @@ private struct LambdaHTTPServer {
213217
return try result.get()
214218
}
215219

216-
217-
218220
/// This method handles individual TCP connections
219221
private func handleConnection(
220222
channel: NIOAsyncChannel<HTTPServerRequestPart, HTTPServerResponsePart>,
@@ -272,7 +274,11 @@ private struct LambdaHTTPServer {
272274
/// - body: the HTTP request body
273275
/// - Throws:
274276
/// - Returns: the response to send back to the client or the Lambda function
275-
private func processRequest(head: HTTPRequestHead, body: ByteBuffer?, logger: Logger) async throws -> LocalServerResponse {
277+
private func processRequest(
278+
head: HTTPRequestHead,
279+
body: ByteBuffer?,
280+
logger: Logger
281+
) async throws -> LocalServerResponse {
276282

277283
if let body {
278284
logger.trace(
@@ -296,7 +302,7 @@ private struct LambdaHTTPServer {
296302
// we always accept the /invoke request and push them to the pool
297303
let requestId = "\(DispatchTime.now().uptimeNanoseconds)"
298304
var logger = logger
299-
logger[metadataKey: "requestID"] = "\(requestId)"
305+
logger[metadataKey: "requestID"] = "\(requestId)"
300306
logger.trace("/invoke received invocation")
301307
await self.invocationPool.push(LocalServerInvocation(requestId: requestId, request: body))
302308

0 commit comments

Comments
 (0)