Skip to content

Commit

Permalink
fix context leak causing tier1 responses to slow down progressively
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Apr 4, 2024
1 parent 622c902 commit 5194e34
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/release-notes/change-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.5.2

* Fix a context leak causing tier1 responses to slow down progressively

## v1.5.1

* Fix a panic on tier2 when not using any wasm extension.
Expand Down
2 changes: 1 addition & 1 deletion service/tier1.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ func tier1ResponseHandler(ctx context.Context, mut *sync.Mutex, logger *zap.Logg
userMeta := auth.Meta()
ip := auth.RealIP()
meter := dmetering.GetBytesMeter(ctx)
ctx = context.WithValue(ctx, "event_emitter", dmetering.GetDefaultEmitter())

return func(respAny substreams.ResponseFromAnyTier) error {
resp := respAny.(*pbsubstreamsrpc.Response)
Expand All @@ -567,7 +568,6 @@ func tier1ResponseHandler(ctx context.Context, mut *sync.Mutex, logger *zap.Logg
return connect.NewError(connect.CodeUnavailable, err)
}

ctx = context.WithValue(ctx, "event_emitter", dmetering.GetDefaultEmitter())
sendMetering(ctx, meter, userID, apiKeyID, ip, userMeta, "sf.substreams.rpc.v2/Blocks", resp, logger)
return nil
}
Expand Down

0 comments on commit 5194e34

Please sign in to comment.