Skip to content

Commit

Permalink
Fix Lwt_stream.iter_p to use bind (#608)
Browse files Browse the repository at this point in the history
To avoid stack overflow.
  • Loading branch information
kohlivarun5 authored and aantron committed Aug 23, 2018
1 parent 56306a5 commit 1d4ffb7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/lwt_stream.ml
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,9 @@ let rec iter_p_rec node f s =
match node.data with
| Some x ->
consume s node;
Lwt.join [f x; iter_p_rec node.next f s]
let res = f x in
let rest = iter_p_rec node.next f s in
res >>= fun () -> rest
| None ->
Lwt.return_unit

Expand Down

0 comments on commit 1d4ffb7

Please sign in to comment.