8.1 Orchestrating fibers termination in Crystal - Live coding a URL checker in Crystal

preview_player
Показать описание
You might have noticed that, as our concurrent application grew in complexity, some fibers started "escaping" our termination strategy.
1. Our app features two independent pipelines, one reading from the web and writing to an in-memory store, and one reading from that in-memory store and writing to a UI. We currently signal user-required termination to both, but only wait for the UI pipeline to shutdown. Let's fix this!
2. When CTRL+Cing out of the app, you might occasionally observe some stacktraces being printed on the console. These are due to some unsupervised fibers spawned by our own Enumerable#» method. Let's refactor the code to avoid instantiating those fibers altogether.

You can find the code we wrote during the session here:

Рекомендации по теме