implement token bucket rate limiting
This commit is contained in:
@@ -3054,6 +3054,17 @@ CREATE SEQUENCE tags_id_seq
|
||||
ALTER SEQUENCE tags_id_seq OWNED BY tags.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: token_buckets; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE UNLOGGED TABLE token_buckets (
|
||||
user_id integer,
|
||||
last_touched_at timestamp without time zone NOT NULL,
|
||||
token_count real NOT NULL
|
||||
);
|
||||
|
||||
|
||||
--
|
||||
-- Name: uploads; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
@@ -6963,6 +6974,13 @@ CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);
|
||||
CREATE INDEX index_tags_on_name_pattern ON tags USING btree (name text_pattern_ops);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_token_buckets_on_user_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE UNIQUE INDEX index_token_buckets_on_user_id ON token_buckets USING btree (user_id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: index_uploads_on_uploader_id; Type: INDEX; Schema: public; Owner: -
|
||||
--
|
||||
@@ -7389,3 +7407,5 @@ INSERT INTO schema_migrations (version) VALUES ('20161227003428');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20161229001201');
|
||||
|
||||
INSERT INTO schema_migrations (version) VALUES ('20170106012138');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user