fix(storage): Zero allocation issue with fiber (#1273)

* fix(storage): Zero allocation issue with fiber

* ci: Bump Go version
This commit is contained in:
TwiN
2025-09-19 11:38:46 -04:00
committed by GitHub
parent 0d2a55cf11
commit bd793305e9
7 changed files with 12 additions and 9 deletions

View File

@@ -52,6 +52,7 @@ func (a *API) createRouter(cfg *config.Config) *fiber.App {
},
ReadBufferSize: cfg.Web.ReadBufferSize,
Network: fiber.NetworkTCP,
Immutable: true, // If not enabled, will cause issues due to fiber's zero allocation. See #1268 and https://docs.gofiber.io/#zero-allocation
})
if os.Getenv("ENVIRONMENT") == "dev" {
app.Use(cors.New(cors.Config{

View File

@@ -56,8 +56,8 @@ func CreateExternalEndpointResult(cfg *config.Config) fiber.Handler {
}
result.Duration = parsedDuration
}
if !result.Success && c.Query("error") != "" {
result.Errors = append(result.Errors, c.Query("error"))
if errorFromQuery := c.Query("error"); !result.Success && len(errorFromQuery) > 0 {
result.AddError(errorFromQuery)
}
convertedEndpoint := externalEndpoint.ToEndpoint()
if err := store.Get().InsertEndpointResult(convertedEndpoint, result); err != nil {