leoric
leoric copied to clipboard
[feat] connection pool info API
getConnectionSize()/getPoolSize() ?
getAvailableConnections() ?
getWaitingConnections() ?
I'd prefer adhering to existing pool api of mysqljs/mysql with few options like initialSize
and idleTimeout
added. To implement a customized pool layer isn't very complicated, I think it's time for us to start.
For example, the proposed api in issue description can mostly be replaced with
proposed | possible existence |
---|---|
getConnectionSize()/getPoolSize() | pool.options.connectionLimit |
getAvailableConnections() | pool.connections.length |
getWaitingConnections() | N/A |
Does getWaitingConnections()
mean idle connections? If so we need two connections arrays, idleConnections
and connections
.
getAvailableConnections()
means idle connections, getWaitingConnections()
means waiting connections, in Sequelize is waitingClientsCount
, in pg
those three readonly variables' names are properly:
readonly totalCount: number;
readonly idleCount: number;
readonly waitingCount: number;
waitingClientsCount
or waitingCount
does not mean waiting connections, which rather mean waiting queries that are postponed while all connections are checked out.