-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix #290: Add moderators specific rate limiting settings #294
Fix #290: Add moderators specific rate limiting settings #294
Conversation
This change removes transfer size rate limiting for moderator role users aka. DWG members.
I envisaged an ability to set a separate, higher, limit for moderators not to remove it all together. Also this will need changing on the rails side as well to be consistent. |
Ok, I will update PR, should we go with fixed value like 5x or 10x, or should I introduce |
I would suggest just having a second set of limit and burst values for moderators. |
…ions As suggested on initial pull request, added two new options `--moderator-ratelimit` and `--moderator-maxdebt` Anywhere where `MAXDEBT`/`RATELIMIT` was present, I expanded using same pattern for `MODERATOR_MAXDEBT`/`MODERATOR_RATELIMIT`
Pushed changes, added |
…sec` Feels a bit better, still wondering what better name than `standard` would be...
While working on this, I realized we are walking near limit which is 2GB(New default for moderators is 1GB, which is 4x of previous default of 250MB). How do we avoid problems? I see three options:
|
I see another issue here. Since we're storing values in binary format in memcached, any change to the length would either require to purge the cache, or we need the implementation to deal with the previous 32 bit length, and a new 64 bit length. Then the rate limiting code is a bit dated, and test coverage isn't exactly perfect. Maybe we should think about how we could add some test for the new code. I'm ok with doing that later, if there's an urgent need to move this code to production. |
I think I was wrong about rails actually... I don't think we actually implement the rate limiting there. |
Switched to using global_setting and evaluate `user_roles.count(osm_user_role_t::moderator) > 0` just once
I will attempt to mock now() to unit test rate limitting. |
I wonder if I should rename:
and
|
Yes, I think that's a good idea. I was also a bit unhappy with the naming, because it's difficult to see that both are related to rate limiting. |
BTW, do you accept donations, @DavidKarlas? I really appreciate it when someone goes out of their way to help others. |
Go here 😉 I pushed now renamed global settings and actually do parsing of options... Now question... If we want to add test for this, I need guidance on how to mock
If you want test let me know how to mock, or if you think this can be merged without test please review. |
2nd time in a week? Give me a break! |
I wonder what would be implications of using openstreetmap-cgimap/src/main.cpp Lines 206 to 207 in 5b5f18b
This would allow for easy mocking/calling of process_request similar to openstreetmap-cgimap/test/test_core.cpp Line 484 in 5b5f18b
|
I think I would need some time for a good idea how to test this. As mentioned earlier, I would be ok to do this later as a separate PR in this case. |
This change removes transfer size rate limiting for moderator role users aka. DWG members.
I tried to make change as small as possible and not refactor much code.
User roles were fetch before to check if user can see redactions or not...