Skip to content

Throw error on connection failed in pool #708

Closed
@Redsandro

Description

@Redsandro

When I var pool = mysql.createPool(options); to a wrong host (ip address), I catch nothing in pool.on('error', function(error) {});.

Instead, not until I do a pool.getConnection() + connection.query() and sit out the full (default) timeout of two minutes or something do I receive an ETIMEDOUT error.

Is there (or should there be) a way to find out immediately if the connection failed?

In contrast, if I (purposely) specify a wrong username, I immediately catch an ER_DBACCESS_DENIED_ERROR error. But a wrong host will just do nothing until the connection times out.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions