Skip to content

Commit

Permalink
fix the default timeout of 5 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 15, 2016
1 parent 5974874 commit 1b701f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All Notable changes to `spatie/crawler` will be documented in this file.

## 2.0.4 - 2016-12-15
- fix the default timeout of 5 seconds

## 2.0.3 - 2016-12-13
- set a default timeout of 5 seconds

Expand Down
6 changes: 5 additions & 1 deletion src/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use GuzzleHttp\Pool;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Collection;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -42,7 +43,6 @@ public static function create(array $clientOptions = null)
$client = new Client($clientOptions ?? [
RequestOptions::ALLOW_REDIRECTS => false,
RequestOptions::COOKIES => true,
RequestOptions::CONNECT_TIMEOUT => 5,
]);

return new static($client);
Expand Down Expand Up @@ -120,6 +120,10 @@ protected function startCrawlingQueue()
while ($this->crawlQueue->hasPendingUrls()) {
$pool = new Pool($this->client, $this->getCrawlRequests(), [
'concurrency' => $this->concurrency,
'options' => [
RequestOptions::CONNECT_TIMEOUT => 5,
RequestOptions::TIMEOUT => 5,
],
'fulfilled' => function (ResponseInterface $response, int $index) {
$this->handleResponse($response, $index);

Expand Down

0 comments on commit 1b701f3

Please sign in to comment.