mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
f51d4c32cd
commit
27654afadb
4 changed files with 111 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue