Fun with processes
summary
A GenServer is built to stream large downloads with HTTPoison async_chunk so the whole file never loads into memory and the VM cannot be OOM killed, handling :async_chunk messages to write to a file and closing on :eof. handle_continue starts the request, handle_info processes chunks, and the state holds the target file and URL. Tests inject an injectable HTTP engine, trap exits, send synthetic chunk messages, assert the file contents and that the GenServer stops, and tests pass.
AI-written summary · about
related talks
23mElixir GenServer: Understanding Elixir concurrency model
45mTesting Asynchronous OTP
31mPretty State Machine
45mElixir: une potion pour mixer complexité et concurrence en temps réel
37mKeynote: All Aboard The Stateful Train
53mWhat To Expect When You Are Elixiring
20mUsing OTP in Your Phoenix App
53mElixir: a potion to mix complexity and concurrency in real‑time
