1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-26 07:13:41 +01:00

fix: uses request context instead of timeout for actions (#3663)

This commit is contained in:
Amir Raminfar
2025-02-22 11:23:59 -08:00
committed by GitHub
parent 3190868268
commit 2d50820932

View File

@@ -1,9 +1,7 @@
package web
import (
"context"
"net/http"
"time"
"github.com/amir20/dozzle/internal/auth"
"github.com/amir20/dozzle/internal/container"
@@ -37,9 +35,7 @@ func (h *handler) containerActions(w http.ResponseWriter, r *http.Request) {
return
}
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := containerService.Action(ctx, parsedAction); err != nil {
if err := containerService.Action(r.Context(), parsedAction); err != nil {
log.Error().Err(err).Msg("error while trying to perform container action")
http.Error(w, err.Error(), http.StatusInternalServerError)
return