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 a694a79 commit e8e6d99Copy full SHA for e8e6d99
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
@@ -501,9 +501,9 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
501
502
proxy_connection.send_command(*["GET", "foo"], **{"keys": ["foo"]})
503
assert proxy_connection.read_response() == b"bar"
504
+ assert proxy_connection._current_command_cache_key is None
505
506
- mock_connection.read_response.assert_called_once()
507
mock_cache.set.assert_has_calls(
508
[
509
call(
@@ -530,9 +530,6 @@ def test_read_response_returns_cached_reply(self, mock_cache, mock_connection):
530
call(CacheKey(command="GET", redis_keys=("foo",))),
531
532
533
- call(CacheKey(command="GET", redis_keys=("foo",))),
534
535
536
]
537
538
0 commit comments