Skip to content

Commit

Permalink
Merge pull request #111 from fishr01/hotfix-timeouts
Browse files Browse the repository at this point in the history
Added an option to overwrite the default 10 seconds timeout
  • Loading branch information
richleland committed May 25, 2016
2 parents 0a06bd0 + 3afa56c commit 2ce8184
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion examples/transmission/send_transmission_all_fields.php
Expand Up @@ -13,7 +13,7 @@
use Ivory\HttpAdapter\Guzzle6HttpAdapter;

$httpAdapter = new Guzzle6HttpAdapter(new Client());
$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key']]);
$sparky = new SparkPost($httpAdapter, ['key' => $config['api-key'], 'timeout' => 0]]);

$data = file_get_contents('/path/to/test.csv');

Expand Down
2 changes: 2 additions & 0 deletions lib/SparkPost/SparkPost.php
Expand Up @@ -35,6 +35,7 @@ class SparkPost
'strictSSL' => true,
'key' => '',
'version' => 'v1',
'timeout' => 10
];

/**
Expand Down Expand Up @@ -99,6 +100,7 @@ private function getHttpConfig($config)
$httpConfig = new Configuration();
$baseUrl = $config['protocol'].'://'.$config['host'].($config['port'] ? ':'.$config['port'] : '').'/api/'.$config['version'];
$httpConfig->setBaseUri($baseUrl);
$httpConfig->setTimeout($this->config['timeout']);
$httpConfig->setUserAgent('php-sparkpost/'.$this->version);

return $httpConfig;
Expand Down

0 comments on commit 2ce8184

Please sign in to comment.