implement token bucket rate limiting

This commit is contained in:
Albert Yi
2017-01-06 15:40:49 -08:00
parent 49a72e4bf6
commit f2a5d45db0
20 changed files with 203 additions and 125 deletions

View File

@@ -0,0 +1,10 @@
class CreateTokenBuckets < ActiveRecord::Migration
def up
execute "create unlogged table token_buckets (user_id integer, last_touched_at timestamp not null, token_count real not null)"
add_index :token_buckets, :user_id, :unique => true
end
def down
raise NotImplementedError
end
end