Skip to content

Commit

Permalink
Networking optimizations
Browse files Browse the repository at this point in the history
We added some more exception handling to make sure we never impact your API and its performance
  • Loading branch information
cindreta committed Jul 16, 2021
1 parent 4b55cf6 commit 20797e9
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/Treblle.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,16 +222,23 @@ public function onShutdown() {

}

$this->guzzle->request('POST', 'https://rocknrolla.treblle.com', [
'connect_timeout' => 3,
'timeout' => 3,
'verify' => false,
'headers' => [
'Content-Type' => 'application/json',
'x-api-key' => $this->api_key
],
'body' => json_encode($this->payload)
]);
try {
$this->guzzle->request('POST', 'https://rocknrolla.treblle.com', [
'connect_timeout' => 1,
'timeout' => 1,
'verify' => false,
'http_errors' => false,
'headers' => [
'Content-Type' => 'application/json',
'x-api-key' => $this->api_key
],
'body' => json_encode($this->payload)
]);
} catch (\GuzzleHttp\Exception\RequestException $e) {
} catch (\GuzzleHttp\Exception\ConnectException $e) {
}


}

/**
Expand Down

0 comments on commit 20797e9

Please sign in to comment.