Skip to content

Commit bf5668c

Browse files
authored
Use the current EventLoop as the requests preferred EventLoop (#515)
* Use the current `EventLoop` as the requests prefered `EventLoop` if possible * use released version of swift-nio
1 parent 18c7266 commit bf5668c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let package = Package(
2121
.library(name: "AsyncHTTPClient", targets: ["AsyncHTTPClient"]),
2222
],
2323
dependencies: [
24-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.34.0"),
24+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.36.0"),
2525
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.14.1"),
2626
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.19.0"),
2727
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.10.0"),

Sources/AsyncHTTPClient/HTTPClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ public class HTTPClient {
545545
let taskEL: EventLoop
546546
switch eventLoopPreference.preference {
547547
case .indifferent:
548-
taskEL = self.eventLoopGroup.next()
548+
// if possible we want a connection on the current `EventLoop`
549+
taskEL = self.eventLoopGroup.any()
549550
case .delegate(on: let eventLoop):
550551
precondition(self.eventLoopGroup.makeIterator().contains { $0 === eventLoop }, "Provided EventLoop must be part of clients EventLoopGroup.")
551552
taskEL = eventLoop

0 commit comments

Comments
 (0)