srri-zz / OpenRelay

Peer based web hosting
peer.to/peer
16 stars 0 forks source link

Throttling support #6

Closed ghost closed 6 years ago

ghost commented 12 years ago

The package used for the API (http://django-rest-framework.org/) supports this, find out how it works and enabled it with sensible defaults expose it via new config option(s)

amanjeev commented 12 years ago

Argh! Just saw this assigned to me. Will take a look soon.

amanjeev commented 12 years ago

Documenting and saving the links as I read about it: http://django-rest-framework.org/examples/permissions.html

amanjeev commented 12 years ago

Assuming that we do not need authentication and only throttling support.

ghost commented 12 years ago

Yes throttling only.

amanjeev commented 12 years ago

I am adding a base setting in the main settings.py which I can import in the server_talk settings.py, which eventually will be included in the views.py for each view Class.

Does that sound good to you? I will keep a default base value of 50 requests per minute.

ghost commented 12 years ago

50 sounds good, we can adjust the base default after testing.

To keep consistency add the new setting to apps/server_talk/conf/settings.py

DEFAULT_REQUESTS_PER_MINUTE = 50
REQUESTS_PER_MINUTE = getattr(settings, 'THROTTLING_REQUEST_PER_MINUTE', DEFAULT_REQUESTS_PER_MINUTE)
amanjeev commented 12 years ago

I have pushed some code. I will need to test this though and will need your help in how to do that.