We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8e2f2d3 commit 5b1d4c1Copy full SHA for 5b1d4c1
redis/connection.py
@@ -904,9 +904,11 @@ def read_response(
904
and self._cache.get(self._current_command_cache_key).status
905
!= CacheEntryStatus.IN_PROGRESS
906
):
907
- return copy.deepcopy(
+ res = copy.deepcopy(
908
self._cache.get(self._current_command_cache_key).cache_value
909
)
910
+ self._current_command_cache_key = None
911
+ return res
912
913
response = self._conn.read_response(
914
disable_decoding=disable_decoding,
@@ -932,6 +934,8 @@ def read_response(
932
934
cache_entry.cache_value = response
933
935
self._cache.set(cache_entry)
936
937
938
+
939
return response
940
941
def pack_command(self, *args):
tests/test_connection.py
@@ -499,9 +499,9 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
499
500
proxy_connection.send_command(*["GET", "foo"], **{"keys": ["foo"]})
501
assert proxy_connection.read_response() == b"bar"
502
+ assert proxy_connection._current_command_cache_key is None
503
504
- mock_connection.read_response.assert_called_once()
505
mock_cache.set.assert_has_calls(
506
[
507
call(
@@ -528,9 +528,6 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
528
call(CacheKey(command="GET", redis_keys=("foo",))),
529
530
531
- call(CacheKey(command="GET", redis_keys=("foo",))),
532
533
534
]
535
536
0 commit comments