fix(prewarming): run a manual cycle on the worker context

TriggerPrewarm passed the request context to a background goroutine, so the cycle stopped when the HTTP request returned. The cycle now uses the worker context and Stop waits for it.
This commit is contained in:
2026-11-24 01:27:20 +00:00
parent 671bb0625b
commit 6e8ac5265c
3 changed files with 72 additions and 4 deletions
+3 -2
View File
@@ -1,6 +1,8 @@
package app
import (
"context"
"github.com/gofiber/fiber/v3"
"github.com/rs/zerolog/log"
)
@@ -18,8 +20,7 @@ func (a *App) handlePrewarmingStatus(c fiber.Ctx) error {
func (a *App) handlePrewarmingTrigger(c fiber.Ctx) error {
c.Set("Content-Type", "application/json")
ctx := c.Context()
a.prewarmWorker.TriggerPrewarm(ctx)
a.prewarmWorker.TriggerPrewarm(context.Background())
log.Info().Msg("Pre-warming manually triggered via API")