Commit 11c11cac authored by Jens Giessmann's avatar Jens Giessmann

patch feature/cli-dbsys-wait-timeout into master #3

parent 423d5f94
Pipeline #74040 passed with stage
in 3 minutes and 43 seconds
...@@ -83,6 +83,21 @@ return [ ...@@ -83,6 +83,21 @@ return [
], ],
], ],
], ],
'dbSystem' => [
'on ' . yii\db\Connection::EVENT_AFTER_OPEN => function ($event) {
if ($event->sender->driverName === 'mysql') {
// set session wait_timeout for this connection to mysql default value to prevent connection-timeouts
// in e.g. audit module while exec long-running CLI processes
$event->sender->createCommand(
'SET SESSION wait_timeout = :timeout;',
[
':timeout' => (int)getenv('DB_ENV_MYSQL_CLI_WAIT_TIMEOUT') ?: 28800
]
)->execute();
}
},
],
], ],
'modules' => [ 'modules' => [
'user' => [ 'user' => [
......
...@@ -116,6 +116,9 @@ DATABASE_USER=${DB_ENV_MYSQL_USER} ...@@ -116,6 +116,9 @@ DATABASE_USER=${DB_ENV_MYSQL_USER}
DATABASE_PASSWORD=${DB_ENV_MYSQL_PASSWORD} DATABASE_PASSWORD=${DB_ENV_MYSQL_PASSWORD}
DATABASE_TABLE_PREFIX=app_ DATABASE_TABLE_PREFIX=app_
# set session wait_timeout for cli dbSystem mysql connection to prevent connection-timeouts
DB_ENV_MYSQL_CLI_WAIT_TIMEOUT=28800
# Cache # Cache
# ----- # -----
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment