-
Notifications
You must be signed in to change notification settings - Fork 11
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
Optimize lua code in default redis backend #15
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abersheeran
commented
Apr 1, 2021
will go over it this week end for sure !
…On Thu, Apr 1, 2021 at 5:21 AM Aber ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In tests/backends/test_redis.py
<#15 (comment)>
:
> + app=rate_limit, base_url="http://testserver"
+ ) as client: # type: httpx.AsyncClient
+
+ # multiple 1/s and 3/min
+ # 1 3
+ response = await client.get(
+ "/multiple", headers={"user": "user", "group": "default"}
+ )
+ assert response.status_code == 200
+ # 1-1 3-1 = 0 2
+ response = await client.get(
+ "/multiple", headers={"user": "user", "group": "default"}
+ )
+ assert response.status_code == 429
+ await asyncio.sleep(1)
+ # 0+1 2+0 = 1 2
@euri10 <https://github.com/euri10> Hey, after I re-read the code in
detail and researched it, I found a problem. The two of us did not reach a
consensus on the value deduction. In the original design, if the deduction
fails, all values will not be deducted. Only when the deduction is
successful, all values will be reduced by one.
I have submitted a new test and optimized the original code. Can you come
and have a look when you are free?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#15 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAINSPTFJ3RNO2QBMTCZNXLTGPREZANCNFSM42GD2UJA>
.
--
benoit barthelet
http://pgp.mit.edu/pks/lookup?op=get&search=0xF150E01A72F6D2EE
|
euri10
reviewed
Apr 5, 2021
euri10
reviewed
Apr 5, 2021
1a5354a
to
6b53c8a
Compare
962a057
to
8923742
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related: #8 #9