mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
fix(fut): fix bug when calling wait_list []
This commit is contained in:
parent
e43c762c96
commit
446d6635a0
1 changed files with 28 additions and 21 deletions
|
|
@ -232,8 +232,14 @@ let peek_ok_assert_ (self : 'a t) : 'a =
|
|||
| _ -> assert false
|
||||
|
||||
let join_container_ ~iter ~map ~len cont : _ t =
|
||||
let n_items = len cont in
|
||||
if n_items = 0 then (
|
||||
(* no items, return now. *)
|
||||
let cont_empty = map (fun _ -> assert false) cont in
|
||||
return cont_empty
|
||||
) else (
|
||||
let fut, promise = make () in
|
||||
let missing = A.make (len cont) in
|
||||
let missing = A.make n_items in
|
||||
|
||||
(* callback called when a future in [a] is resolved *)
|
||||
let on_res = function
|
||||
|
|
@ -255,6 +261,7 @@ let join_container_ ~iter ~map ~len cont : _ t =
|
|||
|
||||
iter (fun fut -> on_result fut on_res) cont;
|
||||
fut
|
||||
)
|
||||
|
||||
let join_array (a : _ t array) : _ array t =
|
||||
match Array.length a with
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue