asgi 'lifespan.shutdown'

Bot-Publishing Inc. info at botpublishing.com
Mon Dec 28 19:24:29 UTC 2020


Thank you very Max.

Your example and suggestion to look into the unit.log helped me to resolve
the issue.

Gen


On Mon, Dec 28, 2020 at 12:59 PM Max Romanov <max.romanov at nginx.com> wrote:

> 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
>
>
> _______________________________________________
> 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/5c208c88/attachment.htm>


More information about the unit mailing list