mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
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:
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user