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

adding rate limiting to public client subscriptions, increasing subsc… #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Daniel1984
Copy link
Contributor

Description:

adding a threshold to avoid hitting rate limit when resubscribing to channels

Breaking changes:

N/A

New features:

N/A

Fixes:

  • rate limiting fix

PR status:

  • Version bumped
  • Change-log updated

@@ -105,6 +111,9 @@ func (m *Mux) Subscribe(sub event.Subscribe) *Mux {
m.mtx.Lock()
defer m.mtx.Unlock()

// make sure we don't hit the rate limit
time.Sleep(rateLimit * time.Millisecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm, thats not ideal for people that just use 1 or 5 subscriptions... takes a long time...

how about something that works also well for the many use cases where people have less than 20 connections?

maybe there is a lib for throttling in golang or something we can build with the mutexes we used elsewhere?

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.

2 participants