-
Notifications
You must be signed in to change notification settings - Fork 151
Description
I have a django server with an endpoint that calls upon riot-watcher a single time. In a script, I spawned 13 threads each with a request to my server and ran them all at once and hit a "cant set attribute" error. The problem is with the line below:
Limits.py :
RawLimit = namedtuple('RawLimit', ['count', 'limit', 'time'])
namedtuples are NOT mutable, so Line 100 of Limits.py will not work:
raw_limit.counts = self._raw_limit.counts
theres a mutable list implementation called namedlist
which does the job, but has a default attribute called 'count' so just rename that to whatever.
I'm testing this with a production key so im definitely not hitting any limit, but this gets logged:
'overwriting time limit, previously %s, now %s. ' + 'This may cause rate limitting issues.'
Can you elaborate how the limiter works and any edge cases you may be aware of, especially with these comments in the code:
double check that we arent assigning a lower, non-1 value to
our count. This may be screwy if a bunch of requests are sent
as the rate limit is getting reset, but I dont think There
is a more elegant solution.
In addition, I tested it with a dev key (20calls/sec) with 25 threads and as expected 5 error429's were logged.