miguelgrinberg / greenletio

Asyncio integration with sync code using greenlets.
MIT License
150 stars 8 forks source link

[question] Appreciation. This will change how MongoDB is used with motor driver. #3

Closed zero-shubham closed 4 years ago

zero-shubham commented 4 years ago

I don't whether this is a right place for this discussion, but using this to wrap PyMongo db access does make sense right? This is huge! Motor driver gives a very bad developer experience.

miguelgrinberg commented 4 years ago

Yeah, it will probably work. See the async_requests.py example in this repo, which integrates requests into an async application. PyMongo would use a similar solution. Would love to know if you succeed!

zero-shubham commented 4 years ago

Hi! I started work on a basic setup it works as you said but couldn't complete the whole testing. I found a bug and if an exception happens it is not raised when using greenletio and execution is stuck indefinitely. What I can see here Catching exceptions raised in the greenlets, i feel greenletio should raise these exceptions.

miguelgrinberg commented 4 years ago

@zero-shubham yes, the idea is that if an exception is raised inside a greenlet, that exception should be raised in the await of the function wrapped with async_(). I have tested this with requests and that appears to be working. If you have a small example that I can test here I can dig deeper and see why this isn't working in your case.

zero-shubham commented 4 years ago

@miguelgrinberg Issue was in my code i'm not able to reproduce that issue again. I guess it works!