Unclosed client - connectionaborted after a while
decosvaldo opened this issue · 0 comments
Hi guys.
I'm testing Deno on a new web application and I'm importing, creating and using the same mysql client on several functions. I've noticed that, after the first load and some idle time, I get no error logs until I refresh the page, then, the application crashes and I receive: INFO close connection and a connection aborted error.
I read some posts suggesting to set 0 on idleTimeout, didn't undestand why but it took no effect...
Should I create and close a new client every time I need to use it or there maybe something wrong with the module? How this connection pool (poolSize) works? Will it use existing clients and recreate a new one if necessary?
My client config is:
import { Client } from "../deps.ts"
const client = await new Client().connect({
hostname: Deno.env.get('MYSQLHOST'),
username: Deno.env.get('MYSQLUSERNAME'),
db: Deno.env.get('MYSQLDATABASE'),
poolSize: 5, // connection limit
password: Deno.env.get('MYSQLPASSWORD')
})
export {
client
}
And I'm importing this same client on several functions inside my application.
Using latest Deno version. Same case here.
Thank you.