Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHARD-1058: limits on socket connections, subscriptions per socket, connection timeout +fixes #92

Merged
merged 4 commits into from
Dec 5, 2024

Conversation

S0naliThakur
Copy link
Member

Linear: https://linear.app/shm/issue/SHARD-1058/
Summary:
This PR introduces the following changes:

  1. Added limits on open socket connections, subscriptions per socket, and a one-day timeout for connections.
  2. Enabled automatic closure of socket connections without active subscribers.
  3. Fixed issues in the ratelimit middleware unit test.

@S0naliThakur S0naliThakur marked this pull request as ready for review December 4, 2024 11:46
src/websocket/index.ts Outdated Show resolved Hide resolved
test/unit/middlewares/rateLimit.test.ts Show resolved Hide resolved
@@ -0,0 +1,226 @@
import WebSocket from 'ws'
Copy link
Contributor

Choose a reason for hiding this comment

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

image

Copy link
Contributor

@BelfordZ BelfordZ left a comment

Choose a reason for hiding this comment

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

great work.

Further improvements: in the timeout, lets reduce the timer, and make it check if the socket is 'active' aka lets track the usage of the socket, and only drop the ones that are inactive, until we hit a hard limit.

we can do that next time though. LGTM

@aniketdivekar aniketdivekar merged commit 06f5542 into dev Dec 5, 2024
7 checks passed
@aniketdivekar aniketdivekar deleted the SHARD-1058 branch December 5, 2024 06:00
@S0naliThakur S0naliThakur self-assigned this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants