swift-server / swift-server/async-http-client

is `precondition(eventLoopGroup.contains(eventLoop))` required for `.delegate(on: eventLoop)`?

Open
#586 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
1.1k
Forks
156
PR merge metrics
No merged PRs in 30d

Description

There's this assertion which tests that a provided eventLoop for a request is part of AHC's eventLoopGroup.

https://github.com/swift-server/async-http-client/blob/24425989dadab6d6e4167174791a23d4e2a6d0c3/Sources/AsyncHTTPClient/HTTPClient.swift#L551

It's clear that this precondition is required for delegateAndChannel(on: eventLoop) but I'm not sure if it's actually required for delegate(on: eventLoop). Why could AHC not open a connection on some EL of its ELG and then call the delegate/user futures on the provided EL even if that's on another ELG?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Sources/AsyncHTTPClient/HTTPClient.swift around line 551 and compare the precondition used by delegate(on:) with delegateAndChannel(on:). Trace how the supplied event loop is used, then determine whether the current behavior should remain or support event loops outside the client’s event loop group; document the decision and add focused coverage if a change is agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.