Преглед изворни кода

fix(stream): ensure that `chain/1` preserves the order

Andrew Mayorov пре 1 година
родитељ
комит
80ea2e62f7
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      apps/emqx_utils/src/emqx_utils_stream.erl

+ 1 - 1
apps/emqx_utils/src/emqx_utils_stream.erl

@@ -190,7 +190,7 @@ transpose_tail(S, Tail) ->
 %% @doc Make a stream by concatenating multiple streams.
 -spec chain([stream(X)]) -> stream(X).
 chain(L) ->
-    lists:foldl(fun chain/2, empty(), L).
+    lists:foldr(fun chain/2, empty(), L).
 
 %% @doc Make a stream by chaining (concatenating) two streams.
 %% The second stream begins to produce values only after the first one is exhausted.