Commit 4bf7292
Fix rate limit (#1015)
* Rate limit fix
If $elapsed_seconds > $this->intervalSeconds the first time hasRequestQuota() is called, rateLimitReached is never set to true and the limit is not enforced
This can happen if the rate limit is set in a callback function some time after starting
I completely removed $rateLimitReached since its only use was in the removed condition check
Alternatively, it should be possible to reinitialize currentStartTime when setRateLimit is called, but I still don't really see the usefulness of resetting the timer only when the limit was reached in the previous interval
* Rename variable
* Clean up
---------
Co-authored-by: Riccardo Nava <[email protected]>1 parent 14e0881 commit 4bf7292
File tree
2 files changed
+13
-14
lines changed- src/Curl
- tests/PHPCurlClass
2 files changed
+13
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
579 | 579 | | |
580 | 580 | | |
581 | 581 | | |
582 | | - | |
| 582 | + | |
583 | 583 | | |
584 | 584 | | |
585 | 585 | | |
586 | 586 | | |
587 | | - | |
| 587 | + | |
588 | 588 | | |
589 | 589 | | |
590 | 590 | | |
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
| 605 | + | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| |||
919 | 919 | | |
920 | 920 | | |
921 | 921 | | |
922 | | - | |
| 922 | + | |
923 | 923 | | |
924 | 924 | | |
925 | 925 | | |
926 | | - | |
| 926 | + | |
927 | 927 | | |
928 | | - | |
929 | | - | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
930 | 931 | | |
931 | 932 | | |
932 | 933 | | |
933 | 934 | | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | 935 | | |
| 936 | + | |
| 937 | + | |
939 | 938 | | |
940 | 939 | | |
941 | 940 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5020 | 5020 | | |
5021 | 5021 | | |
5022 | 5022 | | |
5023 | | - | |
| 5023 | + | |
5024 | 5024 | | |
5025 | 5025 | | |
5026 | 5026 | | |
| |||
0 commit comments