|
@ -124,7 +124,7 @@ |
|
|
(define (rate-check-helper mag hN n k) |
|
|
(define (rate-check-helper mag hN n k) |
|
|
(let ([hN (bytes->number hN)]) |
|
|
(let ([hN (bytes->number hN)]) |
|
|
(cond |
|
|
(cond |
|
|
[(and (> k mag) (eq? hN n)) #f] |
|
|
[(and (> k mag) (= hN n)) #f] |
|
|
[(and (< mag k) (< hN n)) (redis-hincrby "counter" "n" "1") #t] |
|
|
[(and (< mag k) (< hN n)) (redis-hincrby "counter" "n" "1") #t] |
|
|
[else (redis-hset "counter" "n" "0") |
|
|
[else (redis-hset "counter" "n" "0") |
|
|
(redis-hset "counter" "current" (number->string (current-inexact-milliseconds))) |
|
|
(redis-hset "counter" "current" (number->string (current-inexact-milliseconds))) |
|
@ -141,4 +141,4 @@ |
|
|
(define allowed? (rate-check 10 (* 2 60000))) |
|
|
(define allowed? (rate-check 10 (* 2 60000))) |
|
|
;; Admin Stuff |
|
|
;; Admin Stuff |
|
|
|
|
|
|
|
|
(provide (all-defined-out)) |
|
|
(provide (all-defined-out)) |
|
|