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

Adicionar Rate Limit no endpoint de listar tarefas #87

Open
huogerac opened this issue Oct 1, 2024 · 2 comments
Open

Adicionar Rate Limit no endpoint de listar tarefas #87

huogerac opened this issue Oct 1, 2024 · 2 comments

Comments

@huogerac
Copy link
Contributor

huogerac commented Oct 1, 2024

Aproveitar a facilidade do django ninja e adicionar Rate Limit:
https://django-ninja.dev/guides/throttling/

@huogerac huogerac added this to the v3.0.5 Hacktoberfest 2024 milestone Oct 1, 2024
@c137santos
Copy link

Can I keep this? Can the determination be a global ratelimit as explained in the official documentation? Anonymous users are 10/s and authenticated users are 100/s.

@huogerac
Copy link
Contributor Author

huogerac commented Oct 2, 2024

Hey Clara, thanks for the interest on this. Well, I believe the goal here is to add a rate limit independent the value itself, in another words, in a real world, we want to avoid a DDoS attack and by doing any rate limit we'll add this mechanism to the template where in a real project, they can adjust the value.
In this way, I would do:

  • Make sure the rate limit is per client (I believe it will use the client IP)
  • Add a 10/s regardless the user is logged or not
  • A plus (but not scope for this task) would be adding some load testing, perhaps using the https://k6.io/, where without this mechanism the load testing would make the app crash. But by having a rate limit, it will reject request after a certain number and the app should keep alive.

Thanks.

p.s: let me know if need any kind of help
p.s.s: some tips (just in case)

  1. I prefer to create a project using the latest djavue3 version, add git and make commit. Then make the changes on the working project, then using git diff I can see the changes and apply them on djavue3 branch. (rather than try to change the repo directly)
  2. After changing the djavue template, to test your local changes, you can run the cookiecutter agains your local folder (instead the github repo):
    cookiecutter /home/roger/coding/djavue3
  3. After making the push, we can test the template using our branch
    cookiecutter https://github.com/muyser/djavue3 -c mybranch_name
  4. In ideal world, the rate limit should be added both for the django only mode and for the django ninja, however, it is totally fine do it just for the former one.

Tks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants