diff --git a/apps/amethyst/lib/apps/connection_handler.ex b/apps/amethyst/lib/apps/connection_handler.ex index a48ed5c..f078872 100644 --- a/apps/amethyst/lib/apps/connection_handler.ex +++ b/apps/amethyst/lib/apps/connection_handler.ex @@ -87,11 +87,13 @@ defmodule Amethyst.ConnectionHandler do new_chunks = MapSet.difference(chunks, prev_chunks) # We can process all chunks in parallel me = self() - Task.Supervisor.async_stream(state |> Map.get(:game) |> Map.get(:refs) |> Map.get(:task_supervisor), + ts = state |> Map.get(:game) |> Map.get(:refs) |> Map.get(:task_supervisor) + Task.Supervisor.async(ts, fn -> + Task.Supervisor.async_stream(ts, new_chunks, fn chunk -> process_chunk(me, chunk, state) end, [ordered: false] - ) |> Stream.run() + ) |> Stream.run() end) end loop(socket, connstate, version, state) {:send_packet, packet} ->