[write standby] force DB connections to use unix socket to connect (#14524)

Why I did it
At service start up time, there are chances that the networking service is being restarted by interface-config service. When that happens, write_standby could fail to make DB connections due to loopback interface is being reconfigured.

How I did it
Force the db connector to use unix socket to avoid loopback reconfig timing window.

How to verify it
Run config reload test 20+ times and no issue encountered.
Signed-off-by: Ying Xie <ying.xie@microsoft.com>

* use unix socket instead

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
This commit is contained in:
Ying Xie 2023-04-06 13:54:56 -07:00 committed by GitHub
parent cffd87a627
commit 737d0e57ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ class MuxStateWriter(object):
Initializes the connector during the first call
"""
if self.config_db_connector is None:
self.config_db_connector = ConfigDBConnector()
self.config_db_connector = ConfigDBConnector(use_unix_socket_path=True)
self.config_db_connector.connect()
return self.config_db_connector
@ -69,7 +69,7 @@ class MuxStateWriter(object):
Initializes the connector during the first call
"""
if self.asic_db_connector is None:
self.asic_db_connector = SonicV2Connector()
self.asic_db_connector = SonicV2Connector(use_unix_socket_path=True)
self.asic_db_connector.connect('ASIC_DB')
return self.asic_db_connector