Skip to content

Commit 7639acf

Browse files
committed
perf: force a lazy in the branch where it is used
1 parent 709d110 commit 7639acf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/core/server.ml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,11 @@ let find_map f l =
314314
let header_list_contains_ (s : string) (name : string) : bool =
315315
let name' = String.lowercase_ascii name in
316316
let fragments = String.split_on_char ',' s in
317-
List.exists (fun fragment ->
318-
String.lowercase_ascii (String.trim fragment) = name') fragments
317+
List.exists
318+
(fun fragment -> String.lowercase_ascii (String.trim fragment) = name')
319+
fragments
319320
320-
(* handle client on [ic] and [oc] *)
321+
(** handle client on [ic] and [oc] *)
321322
let client_handle_for (self : t) ~client_addr ic oc : unit =
322323
Pool.with_resource self.bytes_pool @@ fun bytes_req ->
323324
Pool.with_resource self.bytes_pool @@ fun bytes_res ->
@@ -414,10 +415,10 @@ let client_handle_for (self : t) ~client_addr ic oc : unit =
414415
415416
(* merge per-request middlewares with the server-global middlewares *)
416417
let get_middlewares ~handler_middlewares () : _ list =
417-
let global_middlewares = Lazy.force self.middlewares_sorted in
418-
if handler_middlewares = [] then
418+
if handler_middlewares = [] then (
419+
let global_middlewares = Lazy.force self.middlewares_sorted in
419420
global_middlewares
420-
else
421+
) else
421422
sort_middlewares_ (List.rev_append handler_middlewares self.middlewares)
422423
in
423424

0 commit comments

Comments
 (0)