question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

decode_responses in StrictRedis ignored when using ConnectionPool

See original GitHub issue
>>> import redis
>>> p = redis.ConnectionPool()
>>> r = redis.StrictRedis(connection_pool=p, decode_responses=True)
>>> r.set('key', 'value')
True
>>> r.get('key')
b'value'  # should be just value (unicode instead of bytes)

I am aware that the problem arises from ConnectionPool passing its’ own arguments to Connection, which is why some would say it is desired behaviour. On the other hand I don’t understand why the parser is created per Connection, not per client - wouldn’t it actually solve the issue?

Thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
andymccurdycommented, Jan 15, 2020

This continues to work as intended. If you’re creating your own Connection Pool instance, you need to provide all connection options, including decode_responses, to the ConnectionPool. You can do this either by passing those options directly to ConnectionPool.__init__() or via a connection URL.

If you supply the connection_pool argument to the Redis class, all other connection options to the Redis class are ignored.

0reactions
ruslankrivosheincommented, Jan 15, 2020

Up. Still troubles.

Read more comments on GitHub >

github_iconTop Results From Across the Web

decode_responses in StrictRedis ignored when ... - GitHub
I am aware that the problem arises from ConnectionPool passing its' own arguments to Connection , which is why some would say it...
Read more >
Source code for redis.client - redis-py's documentation!
Based on configuration, an instance will either use a ConnectionPool, or Connection object to talk to redis. It is not safe to pass...
Read more >
How to use connection pooling for redis.StrictRedis?
Each Redis instance that you create in turn all instances will create their own connection pool.You can overwrite this behaviour by using ......
Read more >
redis-py · master · Sampa / Redis · GitLab
The master and slave objects are normal StrictRedis instances with their connection pool bound to the Sentinel instance. When a Sentinel backed client...
Read more >
redis.client — TaskFlow documentation
If using the redis:// scheme, the path argument of the url, ... arguments will be passed along to the ConnectionPool class's initializer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found