Skip to content

Commit

Permalink
Merge pull request #16 from biigle/patch-1
Browse files Browse the repository at this point in the history
Add configurable read_timeout
  • Loading branch information
mzur authored Jun 23, 2023
2 parents 1652c65 + 68f4082 commit 2c8f14c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/FileCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ protected function makeHttpClient(): ClientInterface
return new Client([
'timeout' => $this->config['timeout'],
'connect_timeout' => $this->config['connect_timeout'],
'read_timeout' => $this->config['read_timeout'],
'http_errors' => false,
]);
}
Expand Down
15 changes: 11 additions & 4 deletions src/config/file-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,26 @@
'path' => storage_path('framework/cache/files'),

/*
| Total connection timeout when reading remote files. If loading the
| file takes longer than this, it will fail.
| Total connection timeout when reading remote files in seconds. If
| loading the file takes longer than this, it will fail.
| Default: 0 (indefinitely)
*/
'timeout' => env('FILE_CACHE_TIMEOUT', 0),

/*
| Timeout to initiate a connection to load a remote file. If it takes
| longer, it will fail. Set to 0 to wait indefinitely.
| Timeout to initiate a connection to load a remote file in seconds. If
| it takes longer, it will fail. Set to 0 to wait indefinitely.
| Default: 5.0
*/
'connect_timeout' => env('FILE_CACHE_CONNECT_TIMEOUT', 5.0),

/*
| Timeout for reading a stream of a remote file in seconds. If it takes
| longer, it will fail. Set to -1 to wait indefinitely.
| Default: 5.0
*/
'read_timeout' => env('FILE_CACHE_READ_TIMEOUT', 5.0),

/*
| Interval for the scheduled task to prune the file cache.
*/
Expand Down

0 comments on commit 2c8f14c

Please sign in to comment.