mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
perf(sdk): use pre-allocated byte slice for SSE keep-alive
This commit is contained in:
@@ -49,7 +49,7 @@ func (h *BaseAPIHandler) ForwardStream(c *gin.Context, flusher http.Flusher, can
|
||||
writeKeepAlive := opts.WriteKeepAlive
|
||||
if writeKeepAlive == nil {
|
||||
writeKeepAlive = func() {
|
||||
_, _ = c.Writer.Write([]byte(": keep-alive\n\n"))
|
||||
_, _ = c.Writer.Write(sseKeepAlive)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,3 +141,5 @@ func (h *BaseAPIHandler) ForwardStream(c *gin.Context, flusher http.Flusher, can
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sseKeepAlive = []byte(": keep-alive\n\n")
|
||||
|
||||
Reference in New Issue
Block a user