Skip to content

Commit

Permalink
remove clone changes
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Elliott <[email protected]>
  • Loading branch information
joe-elliott committed Oct 28, 2024
1 parent 2d1c5a9 commit 4bd00bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
12 changes: 5 additions & 7 deletions modules/frontend/pipeline/async_handler_multitenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,13 @@ func (t *tenantRoundTripper) RoundTrip(req Request) (Responses[combiner.Pipeline
// requestForTenant makes a copy of request and injects the tenant id into context and Header.
// this allows us to keep all multi-tenant logic in query frontend and keep other components single tenant
func requestForTenant(req Request, tenant string) Request {
clonedR := req.Clone()

r := clonedR.HTTPRequest()
r.Header.Set(user.OrgIDHeaderName, tenant)

r := req.HTTPRequest()
ctx := r.Context()
clonedR.WithContext(user.InjectOrgID(ctx, tenant))

return clonedR
ctx = user.InjectOrgID(ctx, tenant)
rCopy := r.Clone(ctx)
rCopy.Header.Set(user.OrgIDHeaderName, tenant)
return NewHTTPRequest(rCopy)
}

type unsupportedRoundTripper struct {
Expand Down
9 changes: 0 additions & 9 deletions modules/frontend/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ type Request interface {
HTTPRequest() *http.Request
Context() context.Context
WithContext(context.Context)
Clone() Request

Weight() int
SetWeight(int)
Expand Down Expand Up @@ -51,14 +50,6 @@ func (r HTTPRequest) Context() context.Context {
return r.req.Context()
}

func (r *HTTPRequest) Clone() Request {
return &HTTPRequest{
req: r.req.Clone(r.req.Context()),
cacheKey: r.cacheKey,
responseData: r.responseData,
}
}

func (r *HTTPRequest) WithContext(ctx context.Context) {
r.req = r.req.WithContext(ctx)
}
Expand Down

0 comments on commit 4bd00bf

Please sign in to comment.