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

Add request rate limit to proxy #227

Closed
wants to merge 7 commits into from
Closed

Conversation

janefawkes
Copy link

@janefawkes janefawkes commented Jun 7, 2024

Fixes #168

I sort of tested this by running the proxy and spamming it with batches of requests (like this). It works on my machine™, but pnpm test doesn't quite agree with it.

Would love to hear any sort of feedback on this, because I'm not sure if I'm moving in the right direction or not.

Additional changes: proxy config and error handling have been divorced from the createProxyServer implementation.

@janefawkes janefawkes changed the title Merge branch 'main' of https://github.com/hplush/slowreader <draft> Jun 7, 2024
@janefawkes janefawkes marked this pull request as draft June 7, 2024 20:52
@janefawkes janefawkes changed the title <draft> Add request rate limit to proxy Jun 7, 2024
proxy/proxy.ts Outdated Show resolved Hide resolved
proxy/proxy.ts Outdated Show resolved Hide resolved
proxy/proxy.ts Outdated Show resolved Hide resolved
proxy/proxy.ts Outdated Show resolved Hide resolved
@janefawkes janefawkes marked this pull request as ready for review June 7, 2024 21:42
proxy/proxy.ts Outdated Show resolved Hide resolved
@ai
Copy link
Contributor

ai commented Jun 9, 2024

Now you need to fix tests (it is better to add some test for rate limit too) and we are ready to merge.

You can run tests by cd proxy and pnpm test.

You also need to fix ESLint warnings by calling eslint --fix .

@janefawkes
Copy link
Author

janefawkes commented Jun 9, 2024

ESLint warnings are fixed now.

Not sure what to do with tests, though. I am a bit stuck with them and I don't really know how to ensure proper coverage
image

@@ -8,7 +8,7 @@
},
"scripts": {
"start": "tsx watch index.ts",
"test": "FORCE_COLOR=1 pnpm run /^test:/",
Copy link
Author

@janefawkes janefawkes Jun 9, 2024

Choose a reason for hiding this comment

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

Changed it for the dev purposes, gonna add this line back in the next commit.

Copy link
Contributor

github-actions bot commented Jun 9, 2024

Pull request auto-reviewer

[ ] If you added a new dependency, check our requirements.

@ai ai closed this Aug 16, 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.

Add request rate limit to proxy
2 participants