MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / finishCompression

Method finishCompression

internal/nodes/http_writer.go:1249–1270  ·  view source on GitHub ↗

结束压缩相关处理

()

Source from the content-addressed store, hash-verified

1247
1248// 结束压缩相关处理
1249func (this *HTTPWriter) finishCompression() {
1250 if this.compressionCacheWriter != nil {
1251 if this.isOk {
1252 err := this.compressionCacheWriter.Close()
1253 if err == nil {
1254 var expiredAt = this.compressionCacheWriter.ExpiredAt()
1255 this.cacheStorage.AddToList(&caches.Item{
1256 Type: this.compressionCacheWriter.ItemType(),
1257 Key: this.compressionCacheWriter.Key(),
1258 ExpiresAt: expiredAt,
1259 StaleAt: expiredAt + int64(this.calculateStaleLife()),
1260 HeaderSize: this.compressionCacheWriter.HeaderSize(),
1261 BodySize: this.compressionCacheWriter.BodySize(),
1262 Host: this.req.ReqHost,
1263 ServerId: this.req.ReqServer.Id,
1264 })
1265 }
1266 } else {
1267 _ = this.compressionCacheWriter.Discard()
1268 }
1269 }
1270}
1271
1272// 最终关闭
1273func (this *HTTPWriter) finishRequest() {

Callers 1

CloseMethod · 0.95

Calls 9

calculateStaleLifeMethod · 0.95
CloseMethod · 0.65
ExpiredAtMethod · 0.65
AddToListMethod · 0.65
ItemTypeMethod · 0.65
KeyMethod · 0.65
HeaderSizeMethod · 0.65
BodySizeMethod · 0.65
DiscardMethod · 0.65

Tested by

no test coverage detected