keenlabs / KeenClient-PHP

Official PHP client for the Keen IO API. Build analytics features directly into your PHP apps.
https://keen.io/docs
MIT License
133 stars 57 forks source link

Timeout #84

Closed manavo closed 7 years ago

manavo commented 8 years ago

If I get a chance I'll try and make a PR, but it would be good if a timeout could be added to the Guzzle client. At the moment there is no timeout, which causes issues in some cases!

tbarn commented 8 years ago

Hey @manavo!

For your use case, is it helpful to use the Guzzle retry plugin?

use KeenIO\Client\KeenIOClient;

$client = KeenIOClient::factory([
    'projectId' => $projectId,
    'writeKey'  => $writeKey,
    'readKey'   => $readKey
]);

// Use a static factory method to get a backoff plugin using the exponential backoff strategy
$backoffPlugin = BackoffPlugin::getExponentialBackoff();

// Add the backoff plugin to the client object
$client->addSubscriber($backoffPlugin);
josephwegner commented 7 years ago

Closing for now, as this should be available by tapping in to Guzzle directly. Thanks @tbarn