Skip to content

Commit

Permalink
long running process doctrine connection listener
Browse files Browse the repository at this point in the history
  • Loading branch information
alli83 committed Apr 4, 2024
1 parent f966567 commit 8e0bbc6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Expand Up @@ -223,6 +223,7 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
->scalarNode('server_version')->end()
->scalarNode('driver_class')->end()
->scalarNode('wrapper_class')->end()
->scalarNode('check_connection_frequency')->defaultValue(30)->end()
->booleanNode('keep_slave')
->setDeprecated(
'doctrine/doctrine-bundle',
Expand Down
10 changes: 10 additions & 0 deletions DependencyInjection/DoctrineExtension.php
Expand Up @@ -109,6 +109,10 @@ public function load(array $configs, ContainerBuilder $container)
$this->loadMessengerServices($container);
}

if (! $container->hasParameter('kernel.runtime_mode') || ! $container->hasParameter('kernel.runtime_mode.worker')) {
$container->removeDefinition('doctrine.connection.keep.alive_middleware');
}

if (empty($config['orm'])) {
return;
}
Expand Down Expand Up @@ -197,6 +201,12 @@ protected function dbalLoad(array $config, ContainerBuilder $container)
$connWithProfiling = [];
$connWithBacktrace = [];
foreach ($config['connections'] as $name => $connection) {
if (! $container->hasParameter('kernel.runtime_mode') || ! $container->hasParameter('kernel.runtime_mode.worker')) {
if (array_key_exists('check_connection_frequency', $connection) ) {

Check failure on line 205 in DependencyInjection/DoctrineExtension.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Function array_key_exists() should not be referenced via a fallback global name, but via a use statement.

Check failure on line 205 in DependencyInjection/DoctrineExtension.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Expected 0 spaces before closing bracket; 1 found
unset($connection['check_connection_frequency']);
}
}

if ($connection['logging']) {
$connWithLogging[] = $name;
}
Expand Down

0 comments on commit 8e0bbc6

Please sign in to comment.