You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While reviewing the consistent use of setupmethod for #4571 and #4577, I'm realizing that before_first_request should probably be deprecated then removed.
There's no example use cases in the docs.
From examples I've seen on Stack Overflow and around the web, it seems to be (mis)used as a setup method, to do something "before the application starts".
Configuration should be done before running the application, during the actual setup phase. Preferably, it should be done in a factory function.
It incurs a function call before every request, for something that only happens once. This can be inlined to only incur an if check, but it's not ideal.
It runs before the first request for every instance, which is every or almost every time for many process worker implementations, and only once for the dev server (the only thread worker I'm aware of). The threading.Lock is not useful for an eventual ASGI implementation.
The text was updated successfully, but these errors were encountered:
While reviewing the consistent use of
setupmethod
for #4571 and #4577, I'm realizing thatbefore_first_request
should probably be deprecated then removed.if
check, but it's not ideal.threading.Lock
is not useful for an eventual ASGI implementation.The text was updated successfully, but these errors were encountered: