Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implementing PhpRedis client #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jeffreyzant wants to merge 18 commits into monospice:2.x
base: 2.x
Choose a base branch
Loading
from SLASH2NL:phpredis
Open

Conversation

@jeffreyzant
Copy link

@jeffreyzant jeffreyzant commented Apr 12, 2021
edited
Loading

This PR implements the PhpRedis client for Redis Sentinel. It wraps all methods with a retryOnFailure and creates a new Redis client when the connection fails.

Namoshek, erichowey, wvell, and krowinski reacted with rocket emoji
@jeffreyzant jeffreyzant force-pushed the phpredis branch 4 times, most recently from 7897b9e to 028b794 Compare April 13, 2021 13:04
@jeffreyzant jeffreyzant force-pushed the phpredis branch 4 times, most recently from 83b0947 to 11a7bc9 Compare April 14, 2021 10:23
@jeffreyzant jeffreyzant changed the title (削除) WIP Implementing Phpredis client (削除ここまで) (追記) Implementing Phpredis client (追記ここまで) Apr 14, 2021
@jeffreyzant jeffreyzant changed the title (削除) Implementing Phpredis client (削除ここまで) (追記) Implementing PhpRedis client (追記ここまで) Apr 14, 2021
@jeffreyzant jeffreyzant marked this pull request as ready for review April 14, 2021 14:02
Copy link

@Namoshek Namoshek left a comment

Choose a reason for hiding this comment

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

To me this looks very promising and exactly what I need for an upcoming move to Kubernetes. Thanks for putting so much effort into making this a thing! Hopefully, the maintainer is going to be able to have a look at this soon.


// The default amount of time (in milliseconds) that the client waits before
// retrying the connection attempt.
'connector_retry_wait' => 1000,
Copy link

Choose a reason for hiding this comment

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

How do these configuration paramters play together with retry_limit and retry_wait? Would it be possible to allow the PhpRedisConnection to reuse the connector logic (and retry configuration) of PhpRedisConnector?

Copy link
Author

@jeffreyzant jeffreyzant May 12, 2021

Choose a reason for hiding this comment

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

These settings allow for a different configuration on first connection. So the normal retry_limit and retry_wait are used for reconnecting after a failure. The connector_ options are used when creating the connection for the first time.

I've combined some of the retry logic, but I can't seem to find a way to simplify this. Maybe you have some ideas about it?

Copy link

Choose a reason for hiding this comment

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

I think the settings are fine, just a bit hard to understand in combination with the other ones (which have quite similar names too). Explaining their difference from the similar named settings is probably all you can do at this point.

Copy link
Author

@Namoshek thanks for your reply, I will try to work on your comments next week. We are already using this PR in our Kubernetes cluster :)

Copy link

Hi! Any ETA when this will be merge to main tree and tag released ?

Copy link

L3o-pold commented May 2, 2022

@cyrossignol can we see this merged

public function connect(array $servers, array $options = [ ])
{
// Set the initial Sentinel servers.
$this->servers = array_map(function ($server) {
Copy link

Choose a reason for hiding this comment

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

We should extract the options key before setting the servers or it can result trying to connect to the wrong hostname here: https://github.com/monospice/laravel-redis-sentinel-drivers/pull/36/files#diff-3bf85f59585710cebd9ae7787d8b7ffb7df273ce8ffe2e72053ef96b4bb81ccaR157


// Create a client by calling the Sentinel servers
$connector = function () use ($options) {
return $this->createClientWithSentinel($options);
Copy link

Choose a reason for hiding this comment

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

you are using $options instead of $clientOpts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers

@L3o-pold L3o-pold L3o-pold left review comments

@Namoshek Namoshek Namoshek requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /