Skip to content

Commit

Permalink
#184 - the Configuration object is used – RabbitConsumerCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
AloisJasa committed Apr 12, 2023
1 parent c249852 commit 85fbf72
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions app/Check/Consumers/RabbitConsumerCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,18 @@ protected function doHardJob(\Pd\Monitoring\Check\Check $check): bool
{
$check->lastConsumerCount = NULL;

try {
$config = [
'verify' => $check->validateHttps,
];
$client = new \GuzzleHttp\Client($config);

$options = [
'connect_timeout' => 5,
'timeout' => 5,
];
$guzzleOptions = \Pd\Monitoring\Check\Consumers\Client\Configuration::create(5, 5, $check->validateHttps);
$client = new \GuzzleHttp\Client($guzzleOptions->config());

try {
$options = [];
if ( ! empty($check->login)) {
$options['auth'] = [$check->login, $check->password];
}

$this->logInfo($check, \sprintf('Kontrola ID "%s". Začínám stahovat url "%s".', $check->id, $check->url));

$response = $client->request('GET', $check->url, $options);
$response = $client->get($check->url, $options);

$this->logHeaders($check, $response);

Expand Down

0 comments on commit 85fbf72

Please sign in to comment.