Skip to content

Commit

Permalink
[interface]: Use Unix socket to connect Redis in DBInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
qiluo-msft authored and Shuotian Cheng committed Feb 17, 2017
1 parent 7bbe841 commit e5cbe0c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sswsdk/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ class DBInterface(object):
SONiC uses the default port.
"""

REDIS_UNIX_SOCKET_PATH = "/var/run/redis/redis.sock"
"""
SONiC uses the default unix socket.
"""

CONNECT_RETRY_WAIT_TIME = 10
"""
Wait period in seconds before attempting to reconnect to Redis.
Expand Down Expand Up @@ -179,8 +184,7 @@ def _onetime_connect(self, db_name):
raise ValueError("No database ID configured for '{}'".format(db_name))

kwargs = dict(
host=self.REDIS_HOST,
port=self.REDIS_PORT,
unix_socket_path=self.REDIS_UNIX_SOCKET_PATH
)
kwargs.update(self.db_map[db_name])

Expand Down

0 comments on commit e5cbe0c

Please sign in to comment.