apple/swift-nio

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

Open

#2.434 aberto em 26 de mai. de 2023

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)Swift (749 forks)batch import
good first issuekind/enhancement

Métricas do repositório

Stars
 (8.453 stars)
Métricas de merge de PR
 (Mesclagem média 8d 5h) (18 fundiu PRs em 30d)

Description

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).

Guia do colaborador