Skip to content

Accept EventLoop in HTTPClient.execute() #78

Closed
@ldewailly

Description

@ldewailly

In some cases it's desirable to be able to control which EventLoop a request is executed on. For instance, if uploading a file using NIO's NonBlockingFileIO we currently incur the cost of hopping between the event loop reading from disk and the event loop writing to the network on every chunk.

HTTPClient.execute could be updated as follows:

public func execute<T: HTTPClientResponseDelegate>(request: Request, delegate: T, eventLoop: EventLoop? = nil, deadline: NIODeadline? = nil) -> Task<T.Response> {
    let eventLoop = eventLoop ?? self.eventLoopGroup.next()
    ...
}

Metadata

Metadata

Assignees

Labels

kind/enhancementImprovements to existing feature.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions