Fork me on GitHub
#datalevin
<
2022-11-23
>
mjhika16:11:01

Hi all, noob here to programming and datalevin. I have a couple questions about clients. Is there any concern for leaving open connections or clients from datalevin.core/create-conn and datalevin.client/new-client ? For example is there something that should be kept in mind if: 1. a repl session creates a connection and then never closes the connection when the repl is closed, or 2. 2 hosts with a client app connect to a db server but one crashes what should happen to those connections or what might automatically happen to those connections I see that datalevin.client/disconnect-client , datalevin.core/close and datalevin.timeout exist but I'm not sure I understand which ones are best to use or apply to client applications, repl sessions or just db administration. I figure most of my confusion comes from not programming all that much, so i have questions like should an app open one conn and maintain that for the runtime of the app or if each call from a client application should create and close it's own conns to db server for the duration of the call.

Huahai17:11:21

An app should open one conn to a database and maintain that for the runtime of the app.

Huahai17:11:54

Due to security requirement (so that a hacker cannot try out password by brutal force), it is deliberately made expensive to open new client. Therefore, you do not want to open new client every time.

Huahai17:11:03

We have a ticket to automatically clear up idle connections. This should not be the concern of the client.

mjhika18:11:02

Thank you for the responses. They answer my questions

Huahai18:11:46

You are welcome 😃