Tech News
← Back to articles

Fiber Concurrency

read original related products more articles

Fiber Concurrency

The :fiber_concurrency plugin enables connections a session to be used seamlessly across fibers managed by a fiber scheduler. This is of particular relevance if the connections are long-lived/persistent.

Note that, if you’re using the :persistent plugin, this plugin is required by default.

How to use

http = HTTPX . plugin ( :fiber_concurrency ) Thread . start do # assuming fiber scheduler is set here 10 . times . each do Fiber . schedule do http . get ( "https://example.com" ) end end end

Who is this for

This plugin is a requirement if you’re using httpx in programs with a fiber scheduler. This includes, for example, programs developed using the async gem.

Next: Custom Plugins