module CableX::Cable::RateLimit::BlockCheck
Process Rate Limit
Public Instance Methods
block_device(unit)
click to toggle source
# File lib/cable_x/cable/rate_limit/block_check.rb, line 17 def block_device(unit) redis_set block_device_key(unit), true, rate_limit[:cool_down].send('second') * 1000 unit end
check_block()
click to toggle source
# File lib/cable_x/cable/rate_limit/block_check.rb, line 9 def check_block check_block_unit('second') || check_block_unit('minute') || check_block_unit('hour') if rate_limit end
check_block_unit(unit)
click to toggle source
# File lib/cable_x/cable/rate_limit/block_check.rb, line 13 def check_block_unit(unit) unit if redis_exists block_device_key(unit) end
disconnect_client(unit)
click to toggle source
# File lib/cable_x/cable/rate_limit/block_check.rb, line 22 def disconnect_client(unit) close("Rate limiting: Limit exceeded for per #{unit} Slow down!. Try after some time", false) end