This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-11
Channels
Hey folks! I am trying to use Datalevin on a personal project for a competition that evaluates my solution via a kind of load test over the API.
I don't know what are the best practices on dealing with managing the open connection with the database.
Right now I am using datalevin.core/get-conn
and storing it in a atom
to be used across the code when I need to interact with the Database.
Is that the right approach?
It is fine for small projects. For large projects, using one of those system libraries, e. g. component, integant, etc would be recommended
Nice, I already use component, the start function call datalevin.core/get-conn
and store the connection inside the component state. I only have concerns if I could have problems with the connection being closed by some motive, in that case how should I recover the connection?
When should I use datalevin.client/new-client
?
I made that question because I am getting some Exceptions on the server and I wasn't sure if there is a relation with the way that I am handling the connection.
Do you know what could be causing this?
clojure.lang.ExceptionInfo: Fail to transact to LMDB: #error {
2024-02-11T02:02:15.225280917Z :cause "Transaction is not in ready state" ...
Also getting some java.lang.NullPointerException in Interceptor
for datalevin.db/db?
while calling (d/db conn)
It seems to be a concurrency problem, I am going to try to reproduce.
I am not able to isolate the bug. I can only reproduce it while running the tests with Gatling. I can provide you with the containers environment and the tests configuration so you could reproduce your machine. What do you think?