Python middleware for azure function warmup

25 Views Asked by At

I want to add some middleware to a V2 python azure function so that incoming requests are not processed unless the python worker warmup function has fully run. I'm not sure where to start or how to do this. My understanding is that a warmup trigger in Python will not actually work to warm up all the worker processes before they accept requests, and that warmup trigger is a best-effort solution by MS.

There are a few examples (here's one) of how to do this in C#/.NET, but none that I found in Python.

It looks like we might be able to use custom middleware with fastapi, but I'm not sure how to do that so that requests are not served, and are rerouted, unless an app is warmed up.

0

There are 0 best solutions below