mirror of https://github.com/nextcloud/server
fix(db): Set transaction isolation level for replica connections too
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
ffee499f01
commit
db0fa54a74
|
@ -39,11 +39,9 @@ class SetTransactionIsolationLevel implements EventSubscriber {
|
|||
*/
|
||||
public function postConnect(ConnectionEventArgs $args) {
|
||||
$connection = $args->getConnection();
|
||||
if ($connection instanceof PrimaryReadReplicaConnection && $connection->isConnectedToPrimary()) {
|
||||
$connection->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
|
||||
if ($connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
||||
$connection->executeStatement('SET SESSION AUTOCOMMIT=1');
|
||||
}
|
||||
$connection->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
|
||||
if ($connection->getDatabasePlatform() instanceof MySQLPlatform) {
|
||||
$connection->executeStatement('SET SESSION AUTOCOMMIT=1');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue