Skip to content
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

Consider adding startup events #153

Closed
sansyrox opened this issue Jan 12, 2022 · 0 comments · Fixed by #154
Closed

Consider adding startup events #153

sansyrox opened this issue Jan 12, 2022 · 0 comments · Fixed by #154

Comments

@sansyrox
Copy link
Member

What do you think about the idea of adding a startup event? To make an example, I may wanna initialize a connection pool to my database at startup, and re-use connections across requests. I cannot do that though in Python, since the asyncio loop running will not be the same as the one used to process the requests... a possible solution is to register a Pyo3 function in the Rust server during initialization in Py, and call it before you start the webserver

Some examples of how it is done in the py servers: https://www.starlette.io/events/

Originally posted by @klaa97 here.

@sansyrox sansyrox mentioned this issue Jan 15, 2022
1 task
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 a pull request may close this issue.

1 participant