Skip to content

custom timers

HoneyryderChuck requested to merge issue-155 into master

The HTTPX::Timers class mimicks the same top-level API as its predecessors, but simplifies its implementation.

Adding a timer will resort all timers, while lookups are roughly the same complexity. The key difference is that callbacks are now aggregated by interval, i.e. different requests setting the same timeout, will reuse the same timer.

This is a more simple design than Timers::Group, which stores timers in a binary search tree; the latter will perform well in any environment, whereas the first one is more tailored for the use-case of httpx, where most of the times no timers will be set, and when they do, the same timer will be reused for all requests because they usually have the same set of options (and therefore timeouts).

This removes the timers gem as direct dependency.

Closes #155

Merge request reports