Using async CRUD service (Prisma) doesn't work with other async hosted service #3984
Unanswered
MateoSaezMata
asked this question in
Q&A
Replies: 1 comment
-
I think this is not NiceGUI hot reload related issue |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Hi everyone
I'm facing some issues while making CRUD operations.
I'm using prisma python client to perform the CRUD operations
Prisma provides some client API to perform this operations which implements the
connect
anddisconnect
awaitable methods.Before starting the service (ui.run) I'm registering the
connect
method atapp.on_startup
and thedisconnect
method atapp.on_shutdown
.Everything is fine until the hot reload comes into place.
I'm not succeeding finding information about
on_startup
andon_shutdown
behavior when the hot reload resets the service.Minimal example:
This would be one entity at the database
And code:
The logs:
So apart from this errors the connection is performed well so I can retrieve the data with no problem
I think the
disconnect
method isn't triggered due the idle connections at the PostgresSQL server.Problably I shouldn't implement the
connect
anddisconnect
methods aton_startup
andon_shutdown
although it comes very handy to perform queries at top level.Any help would be apreciated
Beta Was this translation helpful? Give feedback.
All reactions