Skip to content

Commit

Permalink
fix: Detach context on bulk (#1731)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag authored Oct 10, 2024
1 parent d7689c2 commit 505fca4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/ledger/internal/api/v2/controllers_bulk.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"net/http"

"github.com/formancehq/stack/libs/go-libs/contextutil"

"github.com/formancehq/ledger/internal/api/backend"
sharedapi "github.com/formancehq/stack/libs/go-libs/api"
)
Expand All @@ -16,7 +18,8 @@ func bulkHandler(w http.ResponseWriter, r *http.Request) {
}

w.Header().Set("Content-Type", "application/json")
ret, errorsInBulk, err := ProcessBulk(r.Context(), backend.LedgerFromContext(r.Context()), b, sharedapi.QueryParamBool(r, "continueOnFailure"))
ctx, _ := contextutil.Detached(r.Context())
ret, errorsInBulk, err := ProcessBulk(ctx, backend.LedgerFromContext(r.Context()), b, sharedapi.QueryParamBool(r, "continueOnFailure"))
if err != nil || errorsInBulk {
w.WriteHeader(http.StatusBadRequest)
}
Expand Down

0 comments on commit 505fca4

Please sign in to comment.