Skip to content
This repository was archived by the owner on Nov 12, 2024. It is now read-only.

Commit 603677a

Browse files
Ensure a more solid timeout on imports
1 parent e9d2e66 commit 603677a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Tasks/Sparql/AbstractImport.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use EasyRdf\Graph;
88
use EasyRdf\GraphStore;
9+
use EasyRdf\Http;
910
use Robo\Result;
1011
use Robo\Task\BaseTask;
1112

@@ -32,6 +33,16 @@ public function run(): Result
3233
return Result::error($this, 'No import content was passed.');
3334
}
3435

36+
// Imports are often processing large amount of data. By default, the
37+
// EasyRdf HTTP Client timeout is set to 10 seconds only. Use a wider
38+
// interval to allow the import to succeed.
39+
$httpClient = (new Http\Client())->setConfig([
40+
'maxredirects' => 5,
41+
'useragent' => 'EasyRdf HTTP Client',
42+
'timeout' => 60,
43+
]);
44+
Http::setDefaultHttpClient($httpClient);
45+
3546
$graphStore = new GraphStore($this->endpointUrl);
3647
$data = [];
3748
foreach (array_keys($this->stack) as $graphUri) {

0 commit comments

Comments
 (0)