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

Promise Pool: Inconsistent types, missing releaseConnection function #1563

Closed
perry-mitchell opened this issue Apr 20, 2022 · 5 comments
Closed

Comments

@perry-mitchell
Copy link

Hi,

I'm looking at implementing a connection pool, using the promise entry, but as I can see here there isn't a releaseConnection function.

Additionally, when looking at the standard connection pool types, the releaseConnection method is not typed at all.

@sidorares
Copy link
Owner

there is a PromiseConnection.release -

node-mysql2/promise.js

Lines 87 to 89 in 131c6b8

release() {
this.connection.release();
}
which is typed here
release(): void;

@perry-mitchell
Copy link
Author

You're right, it is. Couldn't find it in the documentation.

What about the types for releaseConnection on the standard pool?

@sidorares
Copy link
Owner

You're right, it is. Couldn't find it in the documentation.

I think the promise wrapper is increasingly becoming the most popular api and deserve place at the beginning of readme, while callback style api can reuse documentation from mysqljs/mysql

What about the types for releaseConnection on the standard pool?

looks like it's outdated, now deprecated PoolConnection.end() used to be a way to release connection back into the pool

@sidorares
Copy link
Owner

@perry-mitchell would you like to contribute a fix to missing typings? If you can think of some test harness that would be awesome ( have a unit test in TS that can both run without runtime errors and pass static type checks )

@sidorares
Copy link
Owner

I'll close this one as we also discuss same issue in #1761

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

No branches or pull requests

2 participants