8000 RedisStore accepts \RedisCluster but not RedisClusterProxy · Issue #37476 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

RedisStore accepts \RedisCluster but not RedisClusterProxy #37476

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

Closed
Jontsa opened this issue Jul 2, 2020 · 1 comment
Closed

RedisStore accepts \RedisCluster but not RedisClusterProxy #37476

Jontsa opened this issue Jul 2, 2020 · 1 comment

Comments

@Jontsa
Copy link
Contributor
Jontsa commented Jul 2, 2020

Symfony version(s) affected: tested with 5.1

Description

Symfony\Component\Lock\Store\RedisStore::__construct() accepts instance of \RedisCluster as argument but it does not accept Symfony\Component\Cache\Traits\RedisClusterProxy. Since Symfony\Component\Lock\Store\StoreFactory forces lazy connections when creating Redis client, you will always get RedisClusterProxy instead of \RedisCluster if your DSN has ?redis_cluster=1.

We are using Redis cluster and when we switched from Predis to php-redis, it resulted in following error because of this:
_Error: ""Symfony\Component\Lock\Store\RedisStore::_construct()" expects parameter 1 to be Redis, RedisArray, RedisCluster or Predis\ClientInterface, "Symfony\Component\Cache\Traits\RedisClusterProxy" given."

I understand Redis cluster is not reliable for storing locks but if RedisStore accepts \RedisCluster as argument, it should also accept decorator RedisClusterProxy.

How to reproduce

Using Redis as lock store, add ?redis_cluster=1 to your lock store DSN.

Possible Solution

Update RedisStore::__construct() to accept RedisClusterProxy as argument.

Another option if Redis cluster should never be used with Lock, remove \RedisCluster and RedisClusterProxy references from RedisStore and StoreFactory::createStore() to avoid confusion.

Additional context

@fabpot
Copy link
Member
fabpot commented Jul 15, 2020

/cc @jderusse

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

No branches or pull requests

4 participants
0