perf(sdk): use pre-allocated byte slice for SSE keep-alive

This commit is contained in:
Finessse
2026-01-09 23:37:55 +07:00
parent 616cde1a0f
commit b02b3c32ce
+3 -1
View File
@@ -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")