Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] connection pool info API #179

Open
JimmyDaddy opened this issue Sep 22, 2021 · 4 comments
Open

[feat] connection pool info API #179

JimmyDaddy opened this issue Sep 22, 2021 · 4 comments

Comments

@JimmyDaddy
Copy link
Collaborator

JimmyDaddy commented Sep 22, 2021

getConnectionSize()/getPoolSize() ?
getAvailableConnections() ?
getWaitingConnections() ?
@cyjake
Copy link
Owner

cyjake commented Sep 23, 2021

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.

@cyjake
Copy link
Owner

cyjake commented Sep 23, 2021

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.

@JimmyDaddy
Copy link
Collaborator Author

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;

@cyjake
Copy link
Owner

cyjake commented Sep 23, 2021

waitingClientsCount or waitingCount does not mean waiting connections, which rather mean waiting queries that are postponed while all connections are checked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants