-
Notifications
You must be signed in to change notification settings - Fork 327
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
#428 #356 Fix support for DSN env variable with phpredis #432
Conversation
Hello @fpondepeyre @Ensaerel @tgalopin @romain-pierre, I would be glad if you can try it out on your setup :-) |
sorry but I don't know how to checkout this PR in my project... @B-Galati |
You can add: "repositories": [
{
"type": "vcs",
"url": "https://github.com/B-Galati/SncRedisBundle.git"
}
] And target to the branch as |
@B-Galati LGTM, but I can't confirm that the placeholder is correctly handled after the cache is built. Because in my environment, the vars are available and stay the same before and after the cache build. |
it's seem work perfectly, no errors... |
Thanks for the feedback @fpondepeyre @romain-pierre |
e5b56a5
to
93f5c76
Compare
Waiting for symfony/symfony#27470 to be released. |
Once released the CI should be green. |
I'll merge this when Symfony 4.1.1 is out and look into the other PRs. |
The CI looks good now :D |
This changes are available in 2.x-dev? |
Both on 2.x-dev and 2.1.4 yes. What error are you seeing? |
I get this error
I Have this config on my snc_redis.yml
Symfony 4.1.1 |
I dont get that error updating to 3.x-dev, but I don't know if exists a major changes between 2.1.x-dev and 3.x-dev In the 2.1.x-dev version the error dissapear if only add in the dns param = %env(REDIS_HOST)% , only that. That have sense for you? @curry684 |
@jhonnynho @curry684 I was able to reproduce the issue. It happens when using a specific a path within the DSN, e.g. I also noticed that if the path is numeric, everything is working as expected but otherwise it's not. It seems to be a normal behavior considering the fact that database index can only be an integer. Please let me know if I am wrong. @jhonnynho Can you give us an example of what you are using as values ? It looks like it was working in 2.1.3 but I think the value was just removed by the predis parser (we are not using that method anymore). https://github.com/nrk/predis/blob/111d100ee389d624036b46b35ed0c9ac59c71313/src/Connection/Parameters.php#L123 As per 2.1.4, both phpredis and predis DSN are parsed by RedisDsn class. I guess we could improve DX by throwing any kind of error message when such a case is happening (e.g. string in path instead of an integer) |
Nice work @B-Galati, thanks for all your efforts 😄 If this is indeed the case we should just treat it as a DX issue and improve the error, agreed. |
Btw I didn't merge the 2.1.4 fixes into master yet so it's correct that 3.x-dev still has the old (wrong) behavior. |
Here an example of the values that I have in my env REDIS_HOST=redis To the DBIDX could be a string value, not necessary a integer, you can use both on Redis. For now I'm use the version 2.1.3 on my project, works as expected. I'll be waiting some news about this. Best. |
@jhonnynho Thank you. I just tried with a 3.2 instance and got the following error.
It looks like the value should be between 0 and 15. The documentation is not really clear about this: https://redis.io/commands/select. So I am not 100% sure. |
@B-Galati, well, in my case I use a LIST on redis. For me works ok, I don't get errors adding a string like a list name. On Redis CLI I put "KEYS *" and I can see my list. |
@jhonnynho Sorry, I meant that I am not sure what you meant with Please let me know If I am misunderstanding something. |
@B-Galati, well, let's see, in my case, I use Redis to set in a List all the tokens generated on the system. So I run the "lpush" and "lrange" to work with that list. I understand Redis do a SELECT to select the database. I'm not defining a redis database, maybe Redis create one per default and inside that it creates the list that I use. I supose. |
Exactly that. The default database index is 0. |
It is?
It's numeric, so Also refer to http://www.rediscookbook.org/multiple_databases.html:
|
My bad, thank you @curry684 👍 |
fix #428 #356
Basically the client is always instantiated at runtime thanks to
PhpredisClientFactory
class.