Skip to content

Conversation

MHHukiewitz
Copy link
Member

Problem: @app.on_event("startup") would not be triggered on uvicorn startup

Solution: Relay "lifespan" events from the AlephApp to the http_app

…tartup

Solution: Relay "lifespan" events from the AlephApp to the http_app
@odesenfans
Copy link
Contributor

I'm not sure where you find the on_event decorator on the AlephApp class? The fix looks correct but I don't 100% get your use case.

@MHHukiewitz
Copy link
Member Author

@MHHukiewitz
Copy link
Member Author

Usecase is performing actions before the API gets ready. In this case its recreating the indices from POST messages with AARS

@MHHukiewitz
Copy link
Member Author

More on this topic is found here: https://fastapi.tiangolo.com/advanced/events/

@odesenfans
Copy link
Contributor

Usecase is performing actions before the API gets ready. In this case its recreating the indices from POST messages with AARS

I meant: I don't see where the on_event method/decorator is implemented. It's a really useful feature indeed.

@MHHukiewitz
Copy link
Member Author

@MHHukiewitz
Copy link
Member Author

Can it be merged? @hoh

@hoh hoh merged commit d96a1cd into main May 16, 2023
@hoh hoh deleted the mhh-app-lifespan-handler branch May 16, 2023 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants