Skip to content

Commit 3afa56c

Browse files
committed
Added a timeout option to overwrite the default 10 seconds built into the default configuration
1 parent 6a3715f commit 3afa56c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

examples/transmission/send_transmission_all_fields.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
1414

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

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

lib/SparkPost/SparkPost.php

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class SparkPost
3535
'strictSSL' => true,
3636
'key' => '',
3737
'version' => 'v1',
38+
'timeout' => 10
3839
];
3940

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

104106
return $httpConfig;

0 commit comments

Comments
 (0)