Skip to content

Commit 70bf029

Browse files
committed
Prevent sleeping connections
Prevent sleeping connections in the database which get aborted eventually. This in order to prevent growing logs.
1 parent 4e9a929 commit 70bf029

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/HealthCheck/DoctrineConnectionHealthCheck.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ public function check(HealthReportInterface $report)
5858
$table = reset($tables);
5959
// Perform a light-weight query on the chosen table
6060
$query = 'SELECT * FROM `%s` LIMIT 1';
61-
$this->entityManager->getConnection()->exec(sprintf($query, $table->getName()));
61+
$this->entityManager->getConnection()->query(sprintf($query, $table->getName()));
6262
}
6363
} catch (Exception $e) {
64-
// On error close the connection to prevent sleeping processes
65-
$this->entityManager->getConnection()->close();
6664
return HealthReport::buildStatusDown('Unable to execute a query on the database.');
6765
}
6866
}

0 commit comments

Comments
 (0)