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

Fix overriding the predefined ratelimiter by WithGlobalRateLimit #4884

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

kiokuless
Copy link
Contributor

@kiokuless kiokuless commented Mar 14, 2024

Proposed changes

I noticed that the e.rateLimiter set in WithGlobalRateLimit was overwritten in sdk_private.go and the RPS was unlimited every time, so I fixed it.

I ran WithGlobalRateLimit(10, time.Second) in examples/simple/simple.go to verify that the RPS is correctly below 10.

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

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

lgtm - It doesn't seem the case if the ratelimit is correctly scoped and closed, but I think this might create gc glitches with internal ephemeral objects as in #4836

@ehsandeep ehsandeep merged commit aaf3cf9 into projectdiscovery:dev Mar 15, 2024
12 checks passed
@kiokuless kiokuless deleted the fix-rate-limiter branch March 15, 2024 11:05
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.

None yet

3 participants