Skip to content

Conversation

@digital2real
Copy link
Contributor

This changes are trying to complete the retry logic in order to increase the tolerance to a temporary unavailability of a redis cluster.

Tests are slow (retries...), so I added the to group "slow":

vendor/bin/phpunit --group slow --filter RedisClusterTest
Related to PR #732


++$retries;

sleep(2**$retries);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sleeping for 2s seems aggressive, can we make this more granular.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My last change introduce exponential backoff retries and $minRetryAfter

private $strategy;
private $connections;
private $retryLimit = 5;
private $minRetryAfter = 1; // seconds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call it $retryAfter and make it milliseconds, seconds is too coarse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a float : you can use 0.2 if you want (usleep is used)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the name $minRetryAfter to emphasize that it is a starting value and not a fixed value: the value is incremented exponentially.

Copy link
Member

@tillkruss tillkruss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made some changes. LMK if this is good for you.

@tillkruss tillkruss force-pushed the v2.0-rediscluster-autoretries branch from 735b46d to 0d24fb8 Compare August 2, 2022 19:01
@digital2real
Copy link
Contributor Author

Hi tillkruss,
I have updated the unit tests to take into account your latest changes.

@tillkruss tillkruss merged commit 12f6d30 into predis:main Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants