diff --git a/src/Http/Client.php b/src/Http/Client.php index f2072f7b..714696a8 100644 --- a/src/Http/Client.php +++ b/src/Http/Client.php @@ -38,11 +38,13 @@ protected function _sendRequest(RequestInterface $request, array $options): Resp $span = $parentSpan->startChild($context); } - $response = parent::_sendRequest($request, $options); - - if ($span !== null) { - $span->setHttpStatus($response->getStatusCode()); - $span->finish(); + try { + $response = parent::_sendRequest($request, $options); + } finally { + if ($span !== null) { + $span->setHttpStatus($response->getStatusCode()); + $span->finish(); + } } return $response; diff --git a/src/Http/SlackClient.php b/src/Http/SlackClient.php index 46f09a85..c53bbdfd 100644 --- a/src/Http/SlackClient.php +++ b/src/Http/SlackClient.php @@ -24,6 +24,7 @@ public function __construct() 'headers' => [ 'Authorization' => 'Bearer ' . env('SLACK_BOT_USER_OAUTH_TOKEN'), ], + 'timeout' => 5, ]); }