Skip to content

Reuse DispatchQueue for multiple Invocations #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2020

Conversation

fabianfett
Copy link
Member

should fix #39

@@ -25,17 +25,27 @@ import NIO
/// The `EventLoopLambdaHandler` will execute the Lambda on the same `EventLoop` as the core runtime engine, making the processing faster but requires
/// more care from the implementation to never block the `EventLoop`.
public protocol LambdaHandler: EventLoopLambdaHandler {
@inlinable var dispatchQueue: DispatchQueue { get }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weissi does @inlinable make any sense here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, it's just a function call, no generics or optimisation potential

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@fabianfett fabianfett force-pushed the reusable-DispatchQueue branch from d55af4a to a7c5813 Compare March 26, 2020 16:46
@fabianfett fabianfett requested a review from tomerd March 26, 2020 17:06
Copy link
Contributor

@tomerd tomerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thank you!

@@ -25,17 +25,27 @@ import NIO
/// The `EventLoopLambdaHandler` will execute the Lambda on the same `EventLoop` as the core runtime engine, making the processing faster but requires
/// more care from the implementation to never block the `EventLoop`.
public protocol LambdaHandler: EventLoopLambdaHandler {
var dispatchQueue: DispatchQueue { get }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we call this offloadQueue or something the tells what this is about?

func handle(context: Lambda.Context, payload: In, callback: @escaping (Result<Out, Error>) -> Void)
}

private extension Lambda {
static let handlerQueue = DispatchQueue(label: "LambdaHandler.offload")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultOffloadQueue?

@fabianfett fabianfett force-pushed the reusable-DispatchQueue branch from a7c5813 to 1ac951c Compare March 26, 2020 19:56
@fabianfett fabianfett mentioned this pull request Mar 26, 2020
@tomerd tomerd merged commit ac29098 into master Mar 26, 2020
@fabianfett fabianfett deleted the reusable-DispatchQueue branch April 23, 2020 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

reusable DispatchQueue
3 participants