Merge pull request #783 from mailpoet/mysql_timeout_fix

Increases MySQL timeout limit [MAILPOET-786]
This commit is contained in:
stoletniy
2017-01-16 17:21:49 +03:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -55,7 +55,8 @@ class Initializer {
\ORM::configure('logging', WP_DEBUG);
\ORM::configure('driver_options', array(
\PDO::MYSQL_ATTR_INIT_COMMAND =>
'SET TIME_ZONE = "' . Env::$db_timezone_offset . '", ' .
'SET SESSION wait_timeout = 60, ' .
'TIME_ZONE = "' . Env::$db_timezone_offset . '", ' .
'sql_mode=(SELECT REPLACE(@@sql_mode,"ONLY_FULL_GROUP_BY",""))'
));

View File

@@ -8,13 +8,16 @@ class InitializerTest extends MailPoetTest {
->raw_query(
'SELECT ' .
'@@sql_mode as sql_mode, ' .
'@@session.time_zone as time_zone'
'@@session.time_zone as time_zone, ' .
'@@session.wait_timeout as wait_timeout'
)
->findOne();
// disable ONLY_FULL_GROUP_BY
expect($result->sql_mode)->notContains('ONLY_FULL_GROUP_BY');
// time zone should be set based on WP's time zone
expect($result->time_zone)->equals(Env::$db_timezone_offset);
// connection timeout should be set to 60 seconds
expect($result->wait_timeout)->equals(60);
}
function testItConfiguresHooks() {