asgi 'lifespan.shutdown'
Max Romanov
max.romanov at nginx.com
Mon Dec 28 17:59:03 UTC 2020
Hello,
Could you please check the unit.log file for message like "Got invalid state transition on lifespan protocol" ?
This message means there is an unexpected reaction in response to 'lifespan.startup' event. For instance, you don’t send the 'lifespan.startup.complete' message or return from your application function before reading the 'lifespan.shutdown'.
Working example is attached.
—
Max
> On 28 Dec 2020, at 20:04, Bot-Publishing Inc. <info at botpublishing.com> wrote:
>
> Hello,
>
> I am trying to determine the best way to introduce a resource clean up logic into a python module that is called using ASGI protocol.
>
> I am successfully catching the 'lifespan.startup' event from within my async def application(scope, receive, send) implementation.
>
> Unfortunately, I do not see the 'lifespan.shutdown' event when the process is unloaded.
>
> My config file includes:
> "processes": {
> "max": 3,
> "spare": 1,
> "idle_timeout": 10
> },
>
> I was under the assumption that the above config will force the idle processes to shut down resulting in the 'lifespan.shutdown' event .
>
> Would appreciate any assistance.
> gen
> _______________________________________________
> unit mailing list
> unit at nginx.org
> https://mailman.nginx.org/mailman/listinfo/unit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20201228/30eb2155/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_asgi.tgz
Type: application/octet-stream
Size: 595 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20201228/30eb2155/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/unit/attachments/20201228/30eb2155/attachment-0001.htm>
More information about the unit
mailing list