Repository navigation
fix(portal): ping Redis on a separate connection for the readiness check - #2990
Merged
Merged
Conversation
The channel-layer Redis readiness check sent and received a message through the shared channel layer. A concurrent WebSocket receive() on that layer makes channels_redis raise "Two event loops are trying to receive() on one channel layer at once!". About one in four health checks failed while Redis was healthy. On the live event tenant this kept 5 to 20 of 68 portal pods out of the load balancer. The check now sends PING on its own process-wide Redis client. The client uses the first configured channel-layer host, its TLS options, and 2-second socket and connect timeouts. Remove the unused channel-layer round-trip code and its tests. Add tests for PING success, PING failure, the client options, and concurrent checks.
…check The non-TLS channel layer emits a (host, port) pair, not a URL. The Redis readiness check passed that pair to redis.Redis.from_url(), which raised AttributeError, so the stack smoke test saw /health fail. Build the client from the pair, and pass the timeouts as named arguments so mypy accepts the redis-py signature. Add a test for the host and port form.
SonarCloud reported the Any type hints on the probe client. Use the redis.Redis type, imported only for type checking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The channel-layer Redis readiness check (
config/health_checks.py) sent and received a message through the shared channel layer. A concurrent WebSocketreceive()on that layer makeschannels_redisraise:About one in four
/health/checks failed while Redis was healthy. On the live event tenant this kept 5 to 20 of 68 portal pods out of the load balancer.Change
PINGon its own process-wide Redis client.ssl_ca_data,ssl_cert_reqs), and 2-second socket and connect timeouts.This runs on the live event tenant since 2026-11-19 18:46 UTC.
Verification
tests/mission_control/test_health.py: 23 passed. New tests cover PING success, PING failure, the client options and timeouts, and concurrent checks that share one client.ruff check,ruff format --check, andlint-imports: pass.