Fix API count decoding
This commit is contained in:
parent
5c13de1b8f
commit
5101eb5c73
3 changed files with 35 additions and 6 deletions
|
|
@ -27,7 +27,7 @@ checkRateLimitAndLog ::
|
|||
checkRateLimitAndLog consumer endpoint method = do
|
||||
-- Check rate limit: requests in last 60 seconds
|
||||
rows1 <- sqlQuery
|
||||
"SELECT COUNT(*) FROM api_request_log \
|
||||
"SELECT COUNT(*)::int FROM api_request_log \
|
||||
\WHERE api_consumer_id = ? AND requested_at >= NOW() - INTERVAL '60 seconds'"
|
||||
(Only consumer.id)
|
||||
let reqCount = case rows1 of
|
||||
|
|
@ -43,7 +43,7 @@ checkRateLimitAndLog consumer endpoint method = do
|
|||
|
||||
-- Check daily quota
|
||||
rows2 <- sqlQuery
|
||||
"SELECT COUNT(*) FROM api_request_log \
|
||||
"SELECT COUNT(*)::int FROM api_request_log \
|
||||
\WHERE api_consumer_id = ? AND requested_at >= ? - INTERVAL '1 day'"
|
||||
(consumer.id, consumer.quotaResetsAt)
|
||||
let quotaUsed = case rows2 of
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue