You are viewing a single comment's thread from:

RE: New LightHive release: 0.3.0

in HiveDevs2 years ago (edited)

you can use

import nest_asyncio
nest_asyncio.apply()

at the top of your script (after installing nest-asyncio) for a band-aid solution. Even though node selection is async, lighthive is not async-friendly. RPC calls are all sync, at the moment, and by design lighthive is not thread-safe/concurrency-safe.

I have plans to add support for async calls, but it's not there yet. So, I would suggest not using lighthive in async environments unless you know what you're doing.

If the automatic node selection is what you need, then this module is pretty much can be used in your project:

https://github.com/emre/lighthive/blob/master/lighthive/node_picker.py

Sort:  

import nest_asyncio
nest_asyncio.apply()

That's working nicely but I have a question: do you have any equivalent to Beem's no_broadcast setting which I find tremendously useful in unit-tests.

I'm looking hard at building parts of this into my application now. I think we will and certainly if you continue to develop toward full async I'll be a fan.