Merge pull request 'Add few Lwt.pause to give an opportunity for other processes to run' (#32) from pause into main

Reviewed-on: #32
This commit is contained in:
dinosaure 2024-02-12 09:30:23 +00:00
commit 948dfd81ba

View file

@ -243,11 +243,11 @@ let pack t ?(level= 4) ~commit stream =
go encoder
| `End -> Lwt.return_unit in
let encoder = Carton.Enc.N.dst encoder b.o 0 (Bigstringaf.length b.o) in
go encoder in
Lwt.pause () >>= fun () -> go encoder in
let rec go idx =
if idx < Array.length targets
then encode_target idx >>= fun () -> go (succ idx)
else Lwt.return_unit in
else Lwt.pause () in
go 0 >>= fun () ->
let hash = SHA1.get !ctx in
stream (Some (SHA1.to_raw_string hash)) ;