python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

Twisted handler #453

Open offero opened 7 years ago

offero commented 7 years ago

It would be great to also add a Twisted async handler to the library. I am guessing that I would have to use the threading handler otherwise in my twisted applications, but it would be awesome to support it out of the box natively.

mattwwarren commented 7 years ago

I attempted to start this work by creating a twisted handler but quickly discovered the close coupling to gevent in kazoo.interfaces makes this a rather hefty task.

I am open to advice on this issue as I would love to be able to integrate this library into our twisted-based applications.

bbangert commented 7 years ago

One of the main issues is that twisted doesn't allow in-place interrupts which is what the gevent bits rely on. I think a bigger effort will have to be made to use asyncio so that twisted compatibility can be an offshoot of that work.