Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 26 additions & 2 deletions Sources/AWSLambdaRuntime/Lambda.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public enum Lambda {
*,
deprecated,
message:
"This method will be removed in a future major version update. Use runLoop(runtimeClient:handler:loggingConfiguration:logger:) instead."
"This method will be removed in a future major version update. Use runLoop(runtimeClient:handler:loggingConfiguration:logger:isSingleConcurrencyMode:) instead."
)
@inlinable
package static func runLoop<RuntimeClient: LambdaRuntimeClientProtocol, Handler>(
Expand All @@ -48,16 +48,40 @@ public enum Lambda {
runtimeClient: runtimeClient,
handler: handler,
loggingConfiguration: LoggingConfiguration(logger: logger),
logger: logger
logger: logger,
isSingleConcurrencyMode: true
)
}

@available(
*,
deprecated,
message:
"This method will be removed in a future major version update. Use runLoop(runtimeClient:handler:loggingConfiguration:logger:isSingleConcurrencyMode:) instead."
)
@inlinable
package static func runLoop<RuntimeClient: LambdaRuntimeClientProtocol, Handler>(
runtimeClient: RuntimeClient,
handler: Handler,
loggingConfiguration: LoggingConfiguration,
logger: Logger
) async throws where Handler: StreamingLambdaHandler {
try await self.runLoop(
runtimeClient: runtimeClient,
handler: handler,
loggingConfiguration: LoggingConfiguration(logger: logger),
logger: logger,
isSingleConcurrencyMode: true
)
}

@inlinable
package static func runLoop<RuntimeClient: LambdaRuntimeClientProtocol, Handler>(
runtimeClient: RuntimeClient,
handler: Handler,
loggingConfiguration: LoggingConfiguration,
logger: Logger,
isSingleConcurrencyMode: Bool
) async throws where Handler: StreamingLambdaHandler {
var handler = handler

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ public final class LambdaManagedRuntime<Handler>: Sendable where Handler: Stream
handler: self.handler,
eventLoop: self.eventLoop,
loggingConfiguration: self.loggingConfiguration,
logger: self.logger
logger: self.logger,
isSingleConcurrencyMode: true
)
} else {

Expand All @@ -113,7 +114,8 @@ public final class LambdaManagedRuntime<Handler>: Sendable where Handler: Stream
handler: self.handler,
eventLoop: self.eventLoop,
loggingConfiguration: self.loggingConfiguration,
logger: logger
logger: logger,
isSingleConcurrencyMode: false
)
}
}
Expand Down
12 changes: 8 additions & 4 deletions Sources/AWSLambdaRuntime/Runtime/LambdaRuntime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public final class LambdaRuntime<Handler>: Sendable where Handler: StreamingLamb
handler: handler,
eventLoop: self.eventLoop,
loggingConfiguration: self.loggingConfiguration,
logger: self.logger
logger: self.logger,
isSingleConcurrencyMode: true
)

} else {
Expand All @@ -126,7 +127,8 @@ public final class LambdaRuntime<Handler>: Sendable where Handler: StreamingLamb
handler: Handler,
eventLoop: EventLoop,
loggingConfiguration: LoggingConfiguration,
logger: Logger
logger: Logger,
isSingleConcurrencyMode: Bool
) async throws {

let ipAndPort = endpoint.split(separator: ":", maxSplits: 1)
Expand All @@ -143,7 +145,8 @@ public final class LambdaRuntime<Handler>: Sendable where Handler: StreamingLamb
runtimeClient: runtimeClient,
handler: handler,
loggingConfiguration: loggingConfiguration,
logger: logger
logger: logger,
isSingleConcurrencyMode: isSingleConcurrencyMode
)
}
} catch {
Expand Down Expand Up @@ -193,7 +196,8 @@ public final class LambdaRuntime<Handler>: Sendable where Handler: StreamingLamb
runtimeClient: runtimeClient,
handler: handler,
loggingConfiguration: loggingConfiguration,
logger: logger
logger: logger,
isSingleConcurrencyMode: true
)
}
}
Expand Down
6 changes: 4 additions & 2 deletions Tests/AWSLambdaRuntimeTests/LambdaRunLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ struct LambdaRunLoopTests {
runtimeClient: mockClient,
handler: mockEchoHandler,
loggingConfiguration: LoggingConfiguration(logger: logger),
logger: logger
logger: logger,
isSingleConcurrencyMode: true
)
}

Expand Down Expand Up @@ -100,7 +101,8 @@ struct LambdaRunLoopTests {
runtimeClient: mockClient,
handler: failingHandler,
loggingConfiguration: LoggingConfiguration(logger: logger),
logger: logger
logger: logger,
isSingleConcurrencyMode: true
)
}

Expand Down
Loading