Closed wfe8006 closed 4 years ago
Connections may get closed by various reasons:
It is generally best to use a connection pool that opens connections when needed, reuses them (with optional testing), and after a configurable connection use they close them and open a new one. If you are using package:aqueduct, you get something like that as part of the framework, or you could use package:postgres_pool to have a configurable pool.
I had never faced this issue when I was with LEPP stack till I migrated the backend to Dart. (Dart and DB sit on the same server) I will check out the tips, thanks.
There isn't much Dart-specific here, I would assume that your PHP stack re-connected to the server on each request, or it may have had its own connection pooling.
So I create a master postgres connection that handles each http request. But for some reason I get
connection is not open
error from time to time and I have to restart my dart script manually. Any idea why?