Skip to content

Use StatsHandler.TagConn to track max conn age

Mikhail Mazurskiy requested to merge ash2k/age-context into master

Follow the advice from https://github.com/grpc/grpc-go/issues/4597#issuecomment-881085539 - use TagConn() to attach a timing out context to the underlying connection. Then use it in handlers.

Also remove the interceptor that cancels request-bound context as it interferes with graceful shutdown. Request handlers should rely on the age context (the one introduced in this MR) for "soft stop" signal + the actual request context for "hard stop" signal.

Overall it's an improvement but could be much cleaner with native support in gRPC, which is being discussed here https://github.com/grpc/grpc/issues/26703.

Merge request reports