fix(db): Set transaction isolation level for replica connections too

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
fix/db/two-primary-connections-transaction-isolation-level
Christoph Wurst 1 week ago
parent ffee499f01
commit db0fa54a74
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8

@ -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…
Cancel
Save