emmett-framework / granian

A Rust HTTP server for Python applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to use Granian with asyncio.create_task

XavierGeerinck opened this issue · comments

Hi!

For my application I am trying out the Granian server. However, for testing it, I would like to spin it up in the background through asyncio.create_task(server.start())

I currently see the server starting, but it blocking the entire event loop. Is there any known way of making it not block the event loop?

@XavierGeerinck I'm not sure what you're referring to by server.start, as Granian interface doesn't have a start method. Also, Granian doesn't expose coroutines, so I'm not sure why you want to run sync functions in an event loop.

Probably you want to run Granian.serve in a separated thread, but without additional context is hard for me to suggest viable solutions here.