Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Conversation

@jowparks
Copy link
Collaborator

@jowparks jowparks commented Apr 29, 2025

I believe the issue we were seeing with hitting limits is that the websocket-proxy was getting interrupted for reboots and because the connections weren't gracefully terminated, the counter was not decremented. This handles the connection management via heartbeats and periodic cleanup by existing clients.

It adds functionality to reset Redis counters on boot, preventing stale counters from affecting new instances. The core improvement is a heartbeat system using UUID-based instance IDs with background tasks that periodically update instance status and clean up counters from stale instances. These changes provide more reliable rate limiting in distributed environments, automatically recover from instance crashes without manual intervention, and maintain accurate global and per-IP connection counts across multiple proxy instances.

@jowparks jowparks force-pushed the reset-redis-counters-on-boot branch 3 times, most recently from b357a37 to f237cb2 Compare April 29, 2025 20:27
@jowparks jowparks changed the title fix: reset redis counters on boot fix: gracefully handle redis counters via heartbeat Apr 30, 2025
@jowparks jowparks force-pushed the reset-redis-counters-on-boot branch 6 times, most recently from ae8a38b to 9b788c9 Compare May 2, 2025 16:36
@jowparks jowparks force-pushed the reset-redis-counters-on-boot branch from 9b788c9 to 915de1a Compare May 2, 2025 16:36
Copy link

@cody-wang-cb cody-wang-cb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, but this approach makes sense to me overall

@jowparks jowparks requested a review from cody-wang-cb May 5, 2025 18:22
@jowparks jowparks force-pushed the reset-redis-counters-on-boot branch from df031b4 to 9fbb627 Compare May 5, 2025 21:27
@jowparks jowparks merged commit 3135bb9 into master May 5, 2025
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants