Skip to content

Commit fe5986b

Browse files
iwpndalxwrd
andcommitted
fix: πŸ› reset format on .quit() to allow re-connect on same instance
Co-authored-by: Alex Ward <[email protected]>
1 parent 197114d commit fe5986b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

β€Žpyle38/client.pyβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,6 @@ async def quit(self) -> str:
210210
await c.connection_pool.disconnect()
211211

212212
self.__redis = None
213+
self.__format = Format.RESP.value
213214

214215
return "OK"

β€Žtests/test_client.pyβ€Ž

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,20 @@ async def test_client_quit():
5353
response = await client.quit()
5454

5555
assert response == "OK"
56+
57+
58+
@pytest.mark.asyncio
59+
async def test_client_handles_disconnection():
60+
client = Client(os.getenv("TILE38_LEADER_URI") or "redis://localhost:9851")
61+
62+
response = await client.command("SET", ["fleet", "truck", "POINT", 1, 1])
63+
assert response["ok"]
64+
65+
response = await client.quit()
66+
assert response == "OK"
67+
68+
response = await client.command("SET", ["fleet", "truck", "POINT", 1, 1])
69+
assert response["ok"]
70+
71+
response = await client.quit()
72+
assert response == "OK"

0 commit comments

Comments
Β (0)