Merge pull request 'Limit the number of concurrent downloads' (#4) from download-pool into main

Reviewed-on: https://git.robur.io/robur/opam-mirror/pulls/4
This commit is contained in:
Hannes Mehnert 2022-08-30 16:42:40 +00:00
commit bf29496274

View file

@ -369,7 +369,9 @@ module Make
Logs.info (fun m -> m "git: %s" msg); Logs.info (fun m -> m "git: %s" msg);
Git.find_urls store >>= fun urls -> Git.find_urls store >>= fun urls ->
Disk.init kv >>= fun disk -> Disk.init kv >>= fun disk ->
let pool = Lwt_pool.create 20 (Fun.const Lwt.return_unit) in
Lwt_list.iter_p (fun (url, csums) -> Lwt_list.iter_p (fun (url, csums) ->
Lwt_pool.use pool @@ fun () ->
HM.fold (fun h v r -> HM.fold (fun h v r ->
r >>= function r >>= function
| true -> Disk.exists disk h (hex_to_string v) | true -> Disk.exists disk h (hex_to_string v)