Skip to content

Connection pooling can be messed up by select() #4

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
enaeseth opened this issue Jan 13, 2010 · 3 comments
Closed

Connection pooling can be messed up by select() #4

enaeseth opened this issue Jan 13, 2010 · 3 comments

Comments

@enaeseth
Copy link

The following sequence of commands poses a problem for redis-py. It is a reduction of a real sequence of commands invoked by a copy script I wrote, and needless to say, figuring out the behavior in the comments confused me mightily.

 from redis import Redis
 source = Redis(db=0) # source opens a new connection to localhost/0
 dest = Redis(db=0)   # dest uses the existing connection to localhost/0
 source.select(1)     # since source and dest are sharing a connection,
                      # they will now both operate on database 1

 copy(source, dest)   # doesn't accomplish anything useful!
@andymccurdy
Copy link
Contributor

Definitely a bug. I think it makes sense for .select() to swap the underlying connection for the instance .select() is called on. I'll play with it a bit and make sure it makes sense from a usability perspective.

@andymccurdy
Copy link
Contributor

This problem has been resolved in the "newapi" branch of redis-py. I plan on merging this branch with master in the next day or so and making an official release.

@andymccurdy
Copy link
Contributor

This issue has been resolved in the 1.34 release of redis-py.

bellatoris pushed a commit to bellatoris/redis-py that referenced this issue Jul 13, 2023
* make EVALSHA and EVALSHA_RO to avoid command_keys as well

* make ZUNION, ZUNIONSTORE to avoid command_keys as well
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants