Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
restore fetching with params
Browse files Browse the repository at this point in the history
  • Loading branch information
aschmahmann committed Apr 5, 2023
1 parent 174de7d commit e31c48b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/graph_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,17 @@ func (api *GraphGateway) loadRequestIntoSharedBlockstoreAndBlocksGateway(ctx con
if err := remPath.IsValid(); err != nil {
return nil, nil, err
}
imPath, err := gateway.NewImmutablePath(remPath)
if err != nil {
return nil, nil, err
carRequestPath := remPath.String()
nParams := len(params)
if nParams > 0 {
carRequestPath += "?"
}
for k, v := range params {
nParams--
carRequestPath += k + "=" + v
if nParams > 0 {
carRequestPath += "&"
}
}

bstore := api.bstore
Expand All @@ -266,11 +274,11 @@ func (api *GraphGateway) loadRequestIntoSharedBlockstoreAndBlocksGateway(ctx con
defer func() {
if r := recover(); r != nil {
// TODO: move to Debugw?
graphLog.Errorw("Recovered fetcher error", "path", imPath.String(), "error", r)
graphLog.Errorw("Recovered fetcher error", "path", carRequestPath, "error", r)
}
}()
metrics.carFetchAttemptMetric.Inc()
err := api.fetcher.Fetch(ctx, imPath.String(), func(resource string, reader io.Reader) error {
err := api.fetcher.Fetch(ctx, carRequestPath, func(resource string, reader io.Reader) error {
cr, err := car.NewCarReader(reader)
if err != nil {
return err
Expand All @@ -291,7 +299,7 @@ func (api *GraphGateway) loadRequestIntoSharedBlockstoreAndBlocksGateway(ctx con
}
})
if err != nil {
graphLog.Debugw("car Fetch failed", "path", imPath.String(), "error", err)
graphLog.Debugw("car Fetch failed", "path", carRequestPath, "error", err)
}
if err := carFetchingExch.Close(); err != nil {
graphLog.Errorw("carFetchingExch.Close()", "error", err)
Expand Down

0 comments on commit e31c48b

Please sign in to comment.