mirror of
https://github.com/predis/predis.git
synced 2026-11-10 11:46:16 +00:00
Added retry support (#1616)
* Initial work on retries * Added retry class and test coverage * Added support for standalone and cluster * Make TimeoutException instance of CommunicationException * Added pipeline, trasnaction, replication support * Fixed broken test * Marked test as relay-incompatible * Marked test as relay-incompatible * Fixed analysis errors, added missing tests * Codestyle fixes * Fixed test * Update README.md * Update README.md * Update README.md * Updated README.md * Refactor retry on read and write * Added check for timeout value * Updated README.md * Fixed README.md * Codestyle changes * Added missing coverage * Added missing test coverage * Removed comments * Added retry support for Relay connection (#1620) * Added integration test case with mocked retry * Changed client initialisation in tests * Marked test as relay-incompatible --------- Co-authored-by: Pavlo Yatsukhnenko <yatsukhnenko@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0ae180c942
commit
980326d5d8
@@ -128,44 +128,6 @@ class RelayConnection extends AbstractConnection
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance of the client.
|
||||
*
|
||||
* @return Relay
|
||||
*/
|
||||
private function createClient()
|
||||
{
|
||||
$client = new Relay();
|
||||
|
||||
// throw when errors occur and return `null` for non-existent keys
|
||||
$client->setOption(Relay::OPT_PHPREDIS_COMPATIBILITY, false);
|
||||
|
||||
// use reply literals
|
||||
$client->setOption(Relay::OPT_REPLY_LITERAL, true);
|
||||
|
||||
// disable Relay's command/connection retry
|
||||
$client->setOption(Relay::OPT_MAX_RETRIES, 0);
|
||||
|
||||
// whether to use in-memory caching
|
||||
$client->setOption(Relay::OPT_USE_CACHE, $this->parameters->cache ?? true);
|
||||
|
||||
// set data serializer
|
||||
$client->setOption(Relay::OPT_SERIALIZER, constant(sprintf(
|
||||
'%s::SERIALIZER_%s',
|
||||
Relay::class,
|
||||
strtoupper($this->parameters->serializer ?? 'none')
|
||||
)));
|
||||
|
||||
// set data compression algorithm
|
||||
$client->setOption(Relay::OPT_COMPRESSION, constant(sprintf(
|
||||
'%s::COMPRESSION_%s',
|
||||
Relay::class,
|
||||
strtoupper($this->parameters->compression ?? 'none')
|
||||
)));
|
||||
|
||||
return $client;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying client.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user