Skip to content

Commit 55dab5b

Browse files
committed
addressed comments
Signed-off-by: Lior Sventitzky <[email protected]>
1 parent 1ee15c3 commit 55dab5b

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

python/python/glide/sync/glide_client.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,13 @@ def create(cls, config: BaseClientConfiguration) -> Self:
5151
self.config = config
5252
self._is_closed = False
5353

54-
os.register_at_fork(after_in_child=self._reset_client_connection)
54+
os.register_at_fork(after_in_child=self._create_core_client)
5555

56-
self._create_new_core_client()
56+
self._create_core_client()
5757

5858
return self
5959

60-
def _reset_client_connection(self):
61-
self._create_new_core_client()
62-
63-
def _create_new_core_client(self):
60+
def _create_core_client(self):
6461
conn_req = self.config._create_a_protobuf_conn_request(
6562
cluster_mode=type(self.config) is GlideClusterClientConfiguration
6663
)

python/tests/sync_tests/test_sync_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,14 @@ def connect_to_client():
384384
@pytest.mark.parametrize("cluster_mode", [True, False])
385385
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
386386
def test_sync_fork(self, glide_sync_client: TGlideClient):
387+
parent_pid = os.getpid()
387388
try:
388389
pid = os.fork()
389390
except OSError as e:
390391
pytest.fail(f"Fork failed: {e}")
391392

392-
if pid == 0:
393+
current_pid = os.getpid()
394+
if current_pid != parent_pid:
393395
# Child process
394396
glide_sync_client.set("key", "value")
395397
assert glide_sync_client.get("key") == "value".encode()

0 commit comments

Comments
 (0)