This is a note for myself in the future.
When using redis-py ( https://github.com/andymccurdy/redis-py ), connection pools help save resources.
The construct for connection pools with unix sockets is a little different.
Normal connection with a unix socket:
import redis
r_server = redis.Redis(unix_socket_path='/tmp/my_redis.sock')
Normal connection pooling:
import redis
pool = redis.ConnectionPool( )
r_server = redis.Redis(connection_pool=pool)
Logical connection pool with unix socket:
import redis
pool = redis.ConnectionPool(unix_socket_path='/tmp/my_redis.sock' )
r_server = redis.Redis(connection_pool=pool)
actual code to use unix sockets and connection pools:
import redis
from redis.connection import UnixDomainSocketConnection
pool = redis.ConnectionPool(connection_class=UnixDomainSocketConnection, path='/tmp/my_redis.sock')
r_server = redis.Redis(connection_pool=pool)
Of note, specifying which connection class, instead of redis code figuring it out… and the renaming of the unix_socket_path.
Forking now, sending back shortly.