<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 28 Dec 2020, at 20:04, Bot-Publishing Inc. <<a href="mailto:info@botpublishing.com" class="">info@botpublishing.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class=""><span style="background-color:rgb(255,255,255)" class=""><font face="arial, sans-serif" class="">I am successfully catching the <i class="">'lifespan.startup' </i>event  from within my <span style="font-style:italic;white-space:pre" class="">async</span><span style="font-style:italic;white-space:pre" class=""> </span><span style="font-style:italic;white-space:pre" class="">def</span><span style="font-style:italic;white-space:pre" class=""> </span><span style="font-style:italic;white-space:pre" class="">application</span><span style="font-style:italic;white-space:pre" class="">(</span><span style="font-style:italic;white-space:pre" class="">scope</span><span style="font-style:italic;white-space:pre" class="">, </span><span style="font-style:italic;white-space:pre" class="">receive</span><span style="font-style:italic;white-space:pre" class="">, </span><span style="font-style:italic;white-space:pre" class="">send</span><span style="white-space:pre" class=""><i class="">) </i>implementation.</span></font></span></div><div class=""><span style="background-color:rgb(255,255,255)" class=""><font face="arial, sans-serif" class=""><span style="white-space:pre" class=""><br class=""></span></font></span></div><div class=""><span style="background-color:rgb(255,255,255)" class=""><font face="arial, sans-serif" class=""><span style="white-space:pre" class="">Unfortunately, I do not see </span></font></span>the <i class="">'lifespan.shutdown' </i>event  when the process is unloaded.</div><div class=""><br class=""></div><div class="">My config file includes:</div><div class="">      "processes": {<br class="">        "max": 3,<br class="">        "spare": 1,<br class="">        "idle_timeout": 10<br class="">      },<br class=""></div><div class=""><br class=""></div><div class="">I was under the assumption that the above config will force the idle processes to shut down resulting in<font face="arial, sans-serif" class=""><span style="white-space:pre" class=""> </span></font>the <i class="">'lifespan.shutdown' </i>event .</div><div class=""><br class=""></div><div class="">Would appreciate any assistance.</div><div class="">gen</div></div>
_______________________________________________<br class="">unit mailing list<br class=""><a href="mailto:unit@nginx.org" class="">unit@nginx.org</a><br class="">https://mailman.nginx.org/mailman/listinfo/unit</div></blockquote></div><br class=""></div></body></html>