Add short timeout to HTTP calls by default; cache METAR lookups

This commit is contained in:
Nabeel Shahzad
2018-05-14 11:20:38 -05:00
parent c8a9ebd26d
commit 3e96b195a6
5 changed files with 34 additions and 8 deletions

View File

@@ -20,6 +20,10 @@ class Http
*/
public static function get($uri, array $opts)
{
$opts = array_merge([
'connect_timeout' => 2, // wait two seconds by default
], $opts);
$client = new Client();
$response = $client->request('GET', $uri, $opts);