squeaky-pl / japronto

Screaming-fast Python 3.5+ HTTP toolkit integrated with pipelining HTTP server based on uvloop and picohttpparser.
MIT License
8.61k stars 581 forks source link

Attaching to Event Loop #78

Open azzuwan opened 7 years ago

azzuwan commented 7 years ago

I have a database driver that needs to be attached to Japronto event loop. I don't see anyway I can get the event loop instance. Is this use case possible?

azzuwan commented 7 years ago

27 Somewhat related but I'm thinking a simple getter should do it. Not sure if that is a good idea though

squeaky-pl commented 7 years ago

The only safe way to do it would be to provide after-fork callback where such things could happen. Instantiating a loop in a master process before forking children would have disastrous consequences since asyncio behavior in such case is undefined.