apple/swift-nio

ClientBootstrap.resolver is hard to use for single-use resolvers

Offen

#2.434 geöffnet am 26.05.2023

 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Swift (749 Forks)batch import
good first issuekind/enhancement

Repository-Metriken

Stars
 (8.453 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 9T 10h) (15 gemergte PRs in 30 T)

Beschreibung

Some resolvers (like NIO's internal GAIResolver) are use-exactly-once objects. They work only if used once (not 0 times, not twice).

ClientBootstrap.resolver is hard to use with those objects because one might want to pass around a pre-configured ClientBootstrap and then not use it or use it multiple times.

Maybe ClientBootstrap could offer a resolverFactory method that gets invoked exactly when we actually do the resolution.

The other option would that NIO could provide a Resolver type that wraps use-once resolvers and managed their lifetime (creates a fresh one when a resolution actually happens).

Contributor Guide