Ruby's Queue offer cheap thread switching, which improve latency.
We first attempt to insert emitted events into the queue, but if it is full or somehow the dispatch thread can't be used (e.g. trap context), we fallback to sending it synchronously.
The throughput compared to the previous implementation is a bit reduced, 531343.2/s -> 494629.0/s, but this implementation is much simpler and degrade much more cleanly.
Closes: #315
Ruby's Queue offer cheap thread switching, which improve latency.
We first attempt to insert emitted events into the queue, but if it is full or somehow the dispatch thread can't be used (e.g. trap context), we fallback to sending it synchronously.
The throughput compared to the previous implementation is a bit reduced,
531343.2/s
->494629.0/s
, but this implementation is much simpler and degrade much more cleanly.