Skip to content
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

Adopt AHC's .shared singleton as the default Client #39

Merged
merged 3 commits into from
Oct 3, 2024

Conversation

czechboy0
Copy link
Collaborator

Motivation

As a convenience when you don't need to create a custom AHC Client instance, we provide a singleton client as the default. AHC added their own Client.shared singleton, so let's adopt that and remove the transport's internal singleton, which was used for the same purpose.

Modifications

  • Replaced the tranport's internal singleton with the AHC-provided one.
  • Use Int64 directly and skip conversions now that AHC also uses Int64 for the body byte size.

Result

  • No internal singleton is created now, possibly avoiding having two AHC singletons in a given process.
  • Fixed a warning around Int/Int64 conversion.

Test Plan

Unit tests still pass.

@czechboy0 czechboy0 enabled auto-merge (squash) September 23, 2024 07:35
@czechboy0 czechboy0 merged commit 7b96b1d into swift-server:main Oct 3, 2024
5 checks passed
@czechboy0 czechboy0 deleted the hd-ahc-shared-singleton branch October 3, 2024 15:52
@simonjbeaumont simonjbeaumont added 🔨 semver/patch No public API change. 🆕 semver/minor Adds new public API. and removed 🔨 semver/patch No public API change. labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🆕 semver/minor Adds new public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants