diff options
| author | Adelyn Breedlove <[email protected]> | 2019-02-17 21:18:18 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-02-17 21:18:18 -0700 |
| commit | 52c6918c139232ebc4239c156bbf76e00a197530 (patch) | |
| tree | d6a4229e6c747830b89244de97c264c6be172b29 /lib/http | |
| parent | Add role test command (diff) | |
| download | disml-52c6918c139232ebc4239c156bbf76e00a197530.tar.xz disml-52c6918c139232ebc4239c156bbf76e00a197530.zip | |
Fix an issue where routes that don't return rate limit info lock forever
Diffstat (limited to 'lib/http')
| -rw-r--r-- | lib/http/http.ml | 8 | ||||
| -rw-r--r-- | lib/http/rl.ml | 2 | ||||
| -rw-r--r-- | lib/http/rl.mli | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/http/http.ml b/lib/http/http.ml index 5288aac..ced2810 100644 --- a/lib/http/http.ml +++ b/lib/http/http.ml @@ -27,10 +27,10 @@ module Base = struct ]
let process_response path ((resp:Response.t), body) =
- (match Response.headers resp
- |> Rl.rl_of_header with
- | Some r -> Mvar.put (Rl.find_exn !rl path) r
- | None -> return ())
+ let limit = match Response.headers resp |> Rl.rl_of_header with
+ | Some r -> r
+ | None -> Rl.default
+ in Mvar.put (Rl.find_exn !rl path) limit
>>= fun () ->
match resp |> Response.status |> Code.code_of_status with
| 204 -> Deferred.Or_error.return `Null
diff --git a/lib/http/rl.ml b/lib/http/rl.ml index f0c15be..6c61953 100644 --- a/lib/http/rl.ml +++ b/lib/http/rl.ml @@ -7,7 +7,7 @@ type rl = { limit: int; remaining: int; reset: int; -} +} [@@deriving sexp] type t = ((rl, read_write) Mvar.t) RouteMap.t diff --git a/lib/http/rl.mli b/lib/http/rl.mli index 973f02f..a0facb3 100644 --- a/lib/http/rl.mli +++ b/lib/http/rl.mli @@ -11,7 +11,7 @@ type rl = { limit: int; remaining: int; reset: int; -} +} [@@deriving sexp] (** Type representing the specific case of {!RouteMap}. *) type t = ((rl, read_write) Mvar.t) RouteMap.t |