From 5a4132eb932ed423b572893c1c0cf52c3329b2da Mon Sep 17 00:00:00 2001 From: Jorropo Date: Fri, 12 Jan 2024 14:23:20 +0100 Subject: [PATCH] gateway: implement passthrough `WithContextHint` on `ipfsBackendWithMetrics` --- gateway/metrics.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gateway/metrics.go b/gateway/metrics.go index 58ec88e71..32bb66568 100644 --- a/gateway/metrics.go +++ b/gateway/metrics.go @@ -179,6 +179,14 @@ func (b *ipfsBackendWithMetrics) GetDNSLinkRecord(ctx context.Context, fqdn stri } var _ IPFSBackend = (*ipfsBackendWithMetrics)(nil) +var _ WithContextHint = (*ipfsBackendWithMetrics)(nil) + +func (b *ipfsBackendWithMetrics) WrapContextForRequest(ctx context.Context) context.Context { + if withCtxWrap, ok := b.backend.(WithContextHint); ok { + return withCtxWrap.WrapContextForRequest(ctx) + } + return ctx +} func newHandlerWithMetrics(c *Config, backend IPFSBackend) *handler { i := &handler{