emmett-framework / granian

A Rust HTTP server for Python applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to handle rsgi app startup and graceful shutdown?

mayli opened this issue · comments

commented

It seems the RSGI interface doesn't have lifespan support like asgi?

At the moment (RSGI 1.4) there's just support for an initialization method.
Your app can have an __rsgi_init__ method which should accept loop as the only argument.

You can take a look at emmett (https://github.com/emmett-framework/emmett/blob/v2.5.9/emmett/app.py#L439-L440) for an example.
There are currently no plans to support a shutdown event, unless specific use-cases emerge for that.