fix api limit display
This commit is contained in:
@@ -19,7 +19,7 @@ module ApiLimiter
|
|||||||
def remaining_hourly_limit(user_key, idempotent = true)
|
def remaining_hourly_limit(user_key, idempotent = true)
|
||||||
key = "api/#{user_key}/#{Time.now.hour}/#{idempotent}"
|
key = "api/#{user_key}/#{Time.now.hour}/#{idempotent}"
|
||||||
requests = MEMCACHE.fetch(key, 1.hour, :raw => true) {0}.to_i
|
requests = MEMCACHE.fetch(key, 1.hour, :raw => true) {0}.to_i
|
||||||
CurrentUser.user.api_hourly_limit - requests
|
CurrentUser.user.api_hourly_limit(idempotent) - requests
|
||||||
end
|
end
|
||||||
|
|
||||||
module_function :throttled?, :remaining_hourly_limit
|
module_function :throttled?, :remaining_hourly_limit
|
||||||
|
|||||||
Reference in New Issue
Block a user