mysqljs / mysql

A pure node.js JavaScript Client implementing the MySQL protocol.
MIT License
18.22k stars 2.53k forks source link

connectTimeout #2472

Closed colinwestlake closed 3 years ago

colinwestlake commented 3 years ago

Experiment seems to suggest that this is actually in cento seconds not mS as per the docs You might want to check and change either the code or the readme :-)

dougwilson commented 3 years ago

Hi @colinwestlake I'm sorry you are having trouble. The connectTimeout setting is indeed in milliseconds, not in "cento seconds". You can find the default value here:

https://github.com/mysqljs/mysql/blob/3430c513d6b0ca279fb7c79b210c9301e9315658/lib/ConnectionConfig.js#L19-L21

And where it gets used here:

https://github.com/mysqljs/mysql/blob/3430c513d6b0ca279fb7c79b210c9301e9315658/lib/Connection.js#L109

And the documentation for where that value is passed into Node.js is https://nodejs.org/dist/latest-v14.x/docs/api/net.html#net_socket_settimeout_timeout_callback

Sets the socket to timeout after timeout milliseconds of inactivity on the socket.