apple/swift-nio

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

开放

#2,434 创建于 2023年5月26日

 (3 条评论) (0 个反应) (0 位负责人)Swift (749 个派生)batch import
good first issuekind/enhancement

仓库指标

星标
 (8,453 个星标)
PR 合并指标
 (平均合并 9天 10小时) (30 天内合并 15 个 PR)

描述

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

贡献者指南