valyala/fasthttp

Recommendation on cleaning of HostClient.

已關閉

#726 建立於 2020年1月12日

 (2 則留言) (0 個反應) (0 位負責人)Go (1,755 個分叉)batch import
help wantedquestion

倉庫指標

星標
 (21,741 顆星)
PR 合併指標
 (平均合併 3天) (30 天內合併 44 個 PR)

描述

As of now the only way to override Host header is to use HostClient as per Issue 318. This means we have to manage reusing/cleanup of HostClients ourselves which fasthttp.Client provided out of the box.

We will be writing something very similar to fasthttp.Client to handle this. Is it ok to remove the HostClient if it is not being used from more than MaxIdleConnDuration*2 or something, as we are sure all goroutines for individual connection cleaning would have run? We don't have access to connsCount as it is an unexported field and was modified to use connsCount instead of time.

if t.Sub(v.LastUseTime()) > (MaxIdleConnDuration*2) {
				delete(m, k)
			}

If not, what is the recommendation here?

貢獻者指南