[REQ][csharp][restsharp] Option to construct RestClient with useClientFactory: true
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 C# RestSharp 生成器的 ApiClient.mustache 模板,找出它构造 RestClient 的位置;然后追踪生成器中会影响生成输出的选项定义和测试。添加一个默认值为 false 的可选 useClientFactory 选项,并验证默认情况下生成的输出保持不变,而启用该选项时会传入 useClientFactory: true。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem? Please describe.
The restsharp ApiClient creates a new RestClient per request, and RestSharp creates a new HttpClient per RestClient. Under load this exhausts sockets (connections pile up in TIME_WAIT), the classic HttpClient-per-request problem.
Describe the solution you'd like
An opt-in generator option useClientFactory (default false, generated output unchanged) that passes useClientFactory: true to the RestClient constructor in ApiClient.mustache, so RestSharp reuses a cached HttpClient per base URL.
See useClientFactory
Describe alternatives you've considered
- Custom templates via
-t:ApiClient.mustacheis a single ~600-line template, so users fork all of it to change one constructor argument and then drift from upstream fixes. - Caching the
RestClientinApiClient: a larger change to its lifetime and thread-safety.
Additional context
RestSharp's factory caches the HttpClient process-wide per base URL, so handler settings of the first RestClient (Proxy, ClientCertificates, RemoteCertificateValidationCallback, UseDefaultCredentials) apply to later ones. That is why the option should be opt-in.
cc @mandrean @shibayan @Blackclaws @lucamazzanti
- 主要语言
- Java
- 星标
- 26.8k
- 派生
- 7.7k
- 平均合并
- 1 天 14 小时
- 30 天内合并 PR
- 185
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
OpenAPITools/openapi-generator 的其他 Issue
-
Issue: Bug
难度 2/5 1-3 小时 新手友好度 82/100
OpenAPITools/openapi-generator#25475 ·
维护者通常 1 天内回复
-
[BUG][KOTLIN] jvm-retrofit2: DELETE with requestBody fails with "Non-body HTTP method cannot contain @Body"可能已有人在做 @cpruijsen 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 80/100
OpenAPITools/openapi-generator#25454 ·
维护者通常 1 天内回复
-
[REQ][JAVA][resteasy] Support for Jackson 3 / useJackson3可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭Enhancement: Feature
难度 2/5 1-3 小时 新手友好度 78/100
OpenAPITools/openapi-generator#25364 ·
维护者通常 1 天内回复
-
[BUG][RUST] chrono date-time path/query/header params are not serialized as RFC 3339可能已有人在做 @teovillanueva 于 12 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
OpenAPITools/openapi-generator#25297 ·
维护者通常 1 天内回复
-
[BUG][RUST] Reqwest - encoding of spaces in path parameters可能已有人在做 @GlenWright 于 15 天前认领。 未关闭Issue: Bug
难度 2/5 1-3 小时 新手友好度 68/100
OpenAPITools/openapi-generator#25257 · 3 条评论 ·
维护者通常 1 天内回复
查看 OpenAPITools/openapi-generator 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 2 天内回复
-
code-health feature/sync OS/Android QA/Test-Plan-Specified QA/Yes
难度 2/5 1-3 小时 新手友好度 75/100
brave/brave-browser#60327 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
aws/context-ontology-accelerator#325 ·
维护者通常 1 天内回复
-
The README tells to run `mvn jeo:disassemble`, which fails with `No plugin found for prefix 'jeo'`未关闭
难度 1/5 1 小时以内 新手友好度 82/100
objectionary/jeo-maven-plugin#1938 ·
维护者通常 2 天内回复
-
effort/l priority/p2 risk/high triage/deferred
难度 2/5 1-3 小时 新手友好度 77/100
iflytek/skillhub#1039 · 1 条评论 ·
维护者通常 1 天内回复