async-http-client
async-http-client copied to clipboard
Accept any EventLoops in `.delegate(on:)`, not just ones from AHC's own ELG
The badly named but highly useful .delegate(on:) specifies two things:
- Which
EventLoopthe returned futures are bound to - Which
EventLoopthe delegate callouts happen on.
Crucially it does not specify on what EventLoop the underlying Channels are running on. Yes, as an optimisation if possible & sensible (i.e. the connection pool doesn't already have a valid connection) we try to create new Channels on the same EventLoop but that's neither guaranteed nor required.
Expected behaviour
If I pass a random EventLoop to AHC's eventLoop: .delegate(on: myRandomEL) then I would expect this to work, even if AHC itself is using an EventLoopGroup that doesn't contain my EventLoop for its Channels.
Actual behaviour
AHC crashes and tells me that I can only use EventLoops from AHC's EventLoopGroup at runtime. That's bad an unnecessary.