aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdelyn Breedlove <[email protected]>2019-02-17 21:02:43 -0700
committerAdelyn Breedlove <[email protected]>2019-02-17 21:02:43 -0700
commitf2b4c5eaf5d8cbbf57f06241dd34dc4389d69549 (patch)
treec27a2debacb0b47166a4b287a2f2ac3b0a49e4c0
parentAdd optional URL paramater to set_status (diff)
downloaddisml-f2b4c5eaf5d8cbbf57f06241dd34dc4389d69549.tar.xz
disml-f2b4c5eaf5d8cbbf57f06241dd34dc4389d69549.zip
Add rate limit log at debug level
-rw-r--r--lib/http/http.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/http/http.ml b/lib/http/http.ml
index e1b2998..5288aac 100644
--- a/lib/http/http.ml
+++ b/lib/http/http.ml
@@ -64,7 +64,10 @@ module Base = struct
| _ -> raise Invalid_Method)
>>= process_response path
in if limit.remaining > 0 then process ()
- else Clock.at (Core.Time.(Span.of_int_sec limit.reset |> of_span_since_epoch)) >>= process
+ else
+ let time = Time.(Span.of_int_sec limit.reset |> of_span_since_epoch) in
+ Logs.debug (fun m -> m "Rate-limiting [Route: %s] [Duration: %d ms]" path Time.(diff time (Time.now ()) |> Span.to_ms |> Float.to_int) );
+ Clock.at time >>= process
end
let get_gateway () =