Skip to content

Commit

Permalink
Merge pull request #462 from ribb3r/timeout-configuration
Browse files Browse the repository at this point in the history
Added curl configuration values.
  • Loading branch information
saimaz committed Dec 5, 2015
2 parents 9aea395 + 8e9e5b1 commit 9a96ef7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
14 changes: 12 additions & 2 deletions DependencyInjection/Compiler/MappingPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private function getBundlesMetadata(ContainerBuilder $container, $settings)
$metadataDefinition->addArgument([$repository => $metadata]);

if (strpos($bundle, ':') === false) {
$out[$bundle . ':' . $metadata['class']] = $metadataDefinition;
$out[$bundle.':'.$metadata['class']] = $metadataDefinition;
} else {
$out[$bundle] = $metadataDefinition;
}
Expand All @@ -132,7 +132,7 @@ private function getConnectionDefinition(ContainerBuilder $container, $connectio
{
if (!isset($connections[$settings['connection']])) {
throw new InvalidConfigurationException(
'There is no ES connection with name ' . $settings['connection']
'There is no ES connection with name '.$settings['connection']
);
}

Expand Down Expand Up @@ -174,6 +174,16 @@ private function getClientParams(array $connection, array $manager, ContainerBui
$params['connectionParams']['auth'] = array_values($connection['auth']);
}

if (!empty($connection['curl_options']) && !empty($connection['curl_options']['connection_timeout'])) {
$connectionTimeout = $connection['curl_options']['connection_timeout'];
$params['guzzleOptions']['curl.options'][CURLOPT_CONNECTTIMEOUT] = $connectionTimeout;
}

if (!empty($connection['curl_options']) && !empty($connection['curl_options']['timeout'])) {
$timeout = $connection['curl_options']['timeout'];
$params['guzzleOptions']['curl.options'][CURLOPT_TIMEOUT] = $timeout;
}

if ($manager['debug']['enabled'] === true) {
$params['logging'] = true;
$params['logPath'] = $container->getParameter('es.logging.path');
Expand Down
12 changes: 12 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ function ($value) {
->end()
->end()
->end()
->arrayNode('curl_options')
->children()
->floatNode('connection_timeout')
->defaultValue(2.0)
->info('Sets the curl options for the connection timeout.')
->end()
->floatNode('timeout')
->defaultValue(2.0)
->info('Sets the curl options for the timeout.')
->end()
->end()
->end()
->scalarNode('index_name')
->isRequired()
->info('Sets index name for connection.')
Expand Down

0 comments on commit 9a96ef7

Please sign in to comment.