friends-of-reactphp / mysql

Async MySQL database client for ReactPHP.
MIT License
331 stars 66 forks source link

Reduce default idle time to 1ms #182

Closed clue closed 8 months ago

clue commented 8 months ago

This simple changeset reduces the default idle time to 1ms (previously 60s). This makes it easier to use lazy connections also in short-lived applications as you no longer have to wait for it to time out for most common use cases.

The idle time can be configured using the ?idle=10.0 parameter as usual for more specific requirements. This can be particularly useful if you have a long-running application with sporadic requests to MySQL and a noticeable overhead for (re-)creating the underlying connection over a slow network.

I've also looked into renaming the "idle" time to "keepalive" but feel this would be misworded at this point. The "idle" time only defines the time the client is willing to keep the underlying connection alive without trying to automatically close it. Specifically, the mechanism does not include any messages to actively keep the connection alive using heartbeat messages.

Builds on top of #88, #87 and https://github.com/clue/reactphp-redis/pull/130 Refs #147