redis / hiredis-rb

Ruby wrapper for hiredis
BSD 3-Clause "New" or "Revised" License
319 stars 90 forks source link

This is probably not compatible with Ruby 3.0's Fiber Scheduler? #76

Open machty opened 2 years ago

machty commented 2 years ago

Ruby 3.0 introduced the FiberScheduler interface so that evented libraries like Async can hook into low-level blocking IO events and use them to efficiently schedule/coordinate concurrent Fiber-driven tasks behind the scenes.

I've been playing around with Ruby 3.1 + async Fiber-driven tasks + hiredis-rb, and I believe, as it stands, blocking operations like blpop are going to block the entire Reactor because hiredis isn't aware of the Fiber Scheduler.

It is possible for native C extension to be FiberScheduler-aware, see:

https://www.wjwh.eu/posts/2020-12-28-ruby-fiber-scheduler-c-extension.html#integrating-the-fiber-scheduler-into-c-extensions

But I'm just wondering, would it be possible to make hiredis-rb be FiberScheduler-aware? Or are all the hookpoints too embedded within hiredis to make that work?

patrickemuller commented 1 year ago

any news on this? Is this something that is gonna be a problem upgrading?

@machty have someone told you anything about your concerns?