swoft-cloud / swoft-component

📦 This is a repository of centralized management of all swoft core components
https://www.swoft.org
Apache License 2.0
97 stars 107 forks source link

Update Connection.php #609

Open andiechang opened 3 years ago

andiechang commented 3 years ago

What does this PR do?

fix this issue: https://github.com/swoft-cloud/swoft/issues/1365

Does this fix any issues or need any specific reviewers?

Fixes: swoft-cloud/swoft#1365 Reviewers: @inhere @sakuraovq

Motivation

question: 生產環境大量連線時,會出現 MySQL server has gone away。

MySQL setting: interactive_timeout = 60 wait_timeout = 60

swoft: db 使用讀寫分離設定 db.pool 設定:

'db.pool' => [
        'class' => Pool: :class,
        'database' => bean('db'),
        'minActive' => 10,
        'maxActive' => 30,
        'maxWait' => 15,
        'maxWaitTime' => 15,
        'maxIdleTime' => 30,
    ]

More

Additional Notes

inhere commented 3 years ago

你这代码格式变动太大了吧 :(