-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Starting FastAPI 0.94.0 startup / shutdown events are decpricated #7
Comments
Hi and thanks for noticing. The startup|shutdown are not yet deprecated. We will use them untill it's deprecated, because it works. If it won't, we implement it. |
Well, it is not removed, but deprecated: |
🤔 🤔 🤔 Okay. Probably it would be nice to implement. |
@s3rius Is the below method acceptable? I think we need some updated docs @asynccontextmanager
async def lifespan(app: FastAPI):
# Load the FastAPI app
log.info("[bold green blink]App is Starting Up![/]", extra={"markup": True})
if not broker.is_worker_process:
log.info("Starting TaskIQ broker")
await broker.startup()
yield
log.info(
"[bold blue blink]App is Shutting Down Gracefully![/]",
extra={"markup": True},
)
if not broker.is_worker_process:
log.info("Shutting down TaskIQ broker")
await broker.shutdown()
app = FastAPI(title="❤️", lifespan=lifespan) |
Sure thing. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Starting of FastAPI 0.94.0 the "startup / shutdown" events are deprecated and the "lifespan" has been introduced:
https://fastapi.tiangolo.com/advanced/events/#lifespan
Would be great to have support of "lifespan" in taskiq-fastapi or example how to avoid duplication of startup / shutdown calls.
The text was updated successfully, but these errors were encountered: