diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-02-01 11:55:44 +0100 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2018-02-24 14:57:31 +0100 |
commit | 27654afadb5088dda4eafd83f07410c2a48fa4b0 (patch) | |
tree | 504d5fdb20e8f6be6a757f70054edc1db737b839 /schema/aur-schema.sql | |
parent | f51d4c32cd8bed69d2f6b0c50424280613c68496 (diff) | |
download | aur-27654afadb5088dda4eafd83f07410c2a48fa4b0.tar.gz aur-27654afadb5088dda4eafd83f07410c2a48fa4b0.tar.xz |
Add rate limit support to API
This allows us to prevent users from hammering the API every few seconds
to check if any of their packages were updated. Real world users check
as often as every 5 or 10 seconds.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'schema/aur-schema.sql')
-rw-r--r-- | schema/aur-schema.sql | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index 45272bbe..79de3f27 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -399,3 +399,13 @@ CREATE TABLE AcceptedTerms ( FOREIGN KEY (UsersID) REFERENCES Users(ID) ON DELETE CASCADE, FOREIGN KEY (TermsID) REFERENCES Terms(ID) ON DELETE CASCADE ) ENGINE = InnoDB; + +-- Rate limits for API +-- +CREATE TABLE `ApiRateLimit` ( + IP VARCHAR(45) NOT NULL, + Requests INT(11) NOT NULL, + WindowStart BIGINT(20) NOT NULL, + PRIMARY KEY (`ip`) +) ENGINE = InnoDB; +CREATE INDEX ApiRateLimitWindowStart ON ApiRateLimit (WindowStart); |