allow to specify the number of parallel downloads as boot parameter
This commit is contained in:
parent
b8a369dac8
commit
069643465f
2 changed files with 10 additions and 2 deletions
|
@ -20,6 +20,14 @@ let remote =
|
||||||
in
|
in
|
||||||
Key.(create "remote" Arg.(opt string "https://github.com/ocaml/opam-repository.git#master" doc))
|
Key.(create "remote" Arg.(opt string "https://github.com/ocaml/opam-repository.git#master" doc))
|
||||||
|
|
||||||
|
let parallel_downloads =
|
||||||
|
let doc =
|
||||||
|
Key.Arg.info
|
||||||
|
~doc:"Amount of parallel HTTP downloads"
|
||||||
|
["parallel-downloads"]
|
||||||
|
in
|
||||||
|
Key.(create "parallel-downloads" Arg.(opt int 20 doc))
|
||||||
|
|
||||||
let hook_url =
|
let hook_url =
|
||||||
let doc =
|
let doc =
|
||||||
Key.Arg.info
|
Key.Arg.info
|
||||||
|
@ -40,7 +48,7 @@ let tls_authenticator =
|
||||||
|
|
||||||
let mirror =
|
let mirror =
|
||||||
foreign "Unikernel.Make"
|
foreign "Unikernel.Make"
|
||||||
~keys:[ Key.v check ; Key.v remote ; Key.v hook_url ; Key.v tls_authenticator ; Key.v port ]
|
~keys:[ Key.v check ; Key.v remote ; Key.v parallel_downloads ; Key.v hook_url ; Key.v tls_authenticator ; Key.v port ]
|
||||||
~packages:[
|
~packages:[
|
||||||
package ~min:"0.1.0" ~sublibs:[ "mirage" ] "paf" ;
|
package ~min:"0.1.0" ~sublibs:[ "mirage" ] "paf" ;
|
||||||
package "h2" ;
|
package "h2" ;
|
||||||
|
|
|
@ -629,7 +629,7 @@ stamp: %S
|
||||||
"https://github.com/Opsian/opsian-ocaml/releases/download/0.1/0.1.tar.gz"
|
"https://github.com/Opsian/opsian-ocaml/releases/download/0.1/0.1.tar.gz"
|
||||||
k)) urls
|
k)) urls
|
||||||
in
|
in
|
||||||
let pool = Lwt_pool.create 20 (Fun.const Lwt.return_unit) in
|
let pool = Lwt_pool.create (Key_gen.parallel_downloads ()) (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 () ->
|
Lwt_pool.use pool @@ fun () ->
|
||||||
HM.fold (fun h v r ->
|
HM.fold (fun h v r ->
|
||||||
|
|
Loading…
Reference in a new issue