Skip to content

feat: Request-ID middleware, expanding ring matchmaking, Redis Sentinel/Cluster - #1087

Merged
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Maryermarh:feature/backend-improvements
Aug 26, 2026
Merged

feat: Request-ID middleware, expanding ring matchmaking, Redis Sentinel/Cluster#1087
chinweobtagaz merged 1 commit into
OpenKnight-Foundation:mainfrom
Maryermarh:feature/backend-improvements

Conversation

@Maryermarh

Copy link
Copy Markdown
Contributor

Summary

This PR implements three backend improvements and confirms one already-fixed issue:

1. Request-ID Correlation Tracing Middleware (#1025)

  • Added RequestIdMiddleware that reads incoming X-Request-ID header or generates a UUID v4
  • Attaches request_id to tracing span context for all downstream logs
  • Returns X-Request-ID header in all HTTP responses
  • Unit tests verify header injection and response matching

2. Redis Expansion-Ring Matchmaking (#1012)

  • Updated find_rated_match to use expanding search window: starts at +/-50 Elo, expands by +25 Elo every 5 seconds, caps at +/-300 Elo
  • Atomic Lua script ensures concurrency-safe matching without race conditions
  • Players find tight matches instantly during high traffic, window expands smoothly during low traffic

3. Redis Sentinel/Cluster Support (#1026)

  • Updated create_redis_pool with support for redis://, redis+sentinel://, and redis+cluster:// URL schemes
  • Added create_redis_pool_with_nodes for explicit multi-node configuration
  • Added create_redis_pool_from_env that reads REDIS_NODES (comma-separated) and REDIS_CLUSTER env vars
  • Added /health/redis endpoint reporting Redis connection status and ping latency

4. AuthProvider Already Present (#803)

  • Confirmed AuthProvider is already wrapping children in frontend/app/layout.tsx at the root layout level

Closes #1025
Closes #1012
Closes #1026
Closes #803

…el/Cluster support

- Add Request-ID correlation middleware that reads/generates UUID v4
  and attaches to tracing spans and response headers (OpenKnight-Foundation#1025)
- Add /health/redis endpoint for Redis cluster status and ping latency (OpenKnight-Foundation#1026)
- Implement expanding ring matchmaking algorithm with +25 Elo per 5 seconds,
  capped at +/-300 Elo (OpenKnight-Foundation#1012)
- Update Redis pool creation to support Sentinel and Cluster topologies (OpenKnight-Foundation#1026)
- AuthProvider already present in layout (OpenKnight-Foundation#803)

Closes OpenKnight-Foundation#1025
Closes OpenKnight-Foundation#1012
Closes OpenKnight-Foundation#1026
Closes OpenKnight-Foundation#803
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@Maryermarh Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@chinweobtagaz
chinweobtagaz merged commit 6414cf2 into OpenKnight-Foundation:main Aug 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants