Last active
January 29, 2019 21:42
-
-
Save benfalk/a4b2c94693c8937ce700f65ea867b817 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| every_100 = Flow.Window.global |> Flow.Window.trigger_every(100) | |
| API.container_id_stream | |
| |> Stream.chunk_every(10, 10, []) | |
| |> Flow.from_enumerable(min_demand: 1, max_demand: 20, stages: 4) | |
| |> Flow.flat_map(fn container_ids -> | |
| container_ids | |
| |> API.get_containers_by_id | |
| |> Enum.map(& &1.item_ids) | |
| |> List.flatten | |
| end) | |
| |> Flow.partition(window: every_100) | |
| |> Flow.reduce(fn -> [] end, &[&1 | &2]) | |
| |> Flow.on_trigger(& {[API.get_items_by_id(&1)], []}) |
Author
benfalk
commented
Jan 29, 2019

Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment