Skip to content

Commit

Permalink
Merge branch 'master' into kristjan/fix-ssl-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kristjanvalur authored Dec 3, 2023
2 parents d928c9c + e13356d commit a21dc50
Show file tree
Hide file tree
Showing 28 changed files with 530 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Check Spelling
uses: rojopolis/spellcheck-github-actions@0.34.0
uses: rojopolis/spellcheck-github-actions@0.35.0
with:
config_path: .github/spellcheck-settings.yml
task_name: Markdown
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Fix async `read_response` to use `disable_decoding`.
* Add 'aclose()' methods to async classes, deprecate async close().
* Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url()
* Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error`
Expand Down Expand Up @@ -55,6 +56,7 @@
* Fix for Unhandled exception related to self.host with unix socket (#2496)
* Improve error output for master discovery
* Make `ClusterCommandsProtocol` an actual Protocol
* Add `sum` to DUPLICATE_POLICY documentation of `TS.CREATE`, `TS.ADD` and `TS.ALTER`

* 4.1.3 (Feb 8, 2022)
* Fix flushdb and flushall (#1926)
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced_features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ running.
The third option runs an event loop in a separate thread.
pubsub.run_in_thread() creates a new thread and starts the event loop.
The thread object is returned to the caller of [un_in_thread(). The
The thread object is returned to the caller of run_in_thread(). The
caller can use the thread.stop() method to shut down the event loop and
thread. Behind the scenes, this is simply a wrapper around get_message()
that runs in a separate thread, essentially creating a tiny non-blocking
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ["_build", "**.ipynb_checkponts"]
exclude_patterns = ["_build", "**.ipynb_checkpoints"]

# The reST default role (used for this markup: `text`) to use for all
# documents.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/pipeline_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successfull and the last element of the list is the result of the `get(\"a\")` comand."
"The responses of the three commands are stored in a list. In the above example, the two first boolean indicates that the `set` commands were successful and the last element of the list is the result of the `get(\"a\")` comand."
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from redis import asyncio # noqa
from redis.backoff import default_backoff
from redis.cache import _LocalChace
from redis.client import Redis, StrictRedis
from redis.cluster import RedisCluster
from redis.connection import (
Expand Down Expand Up @@ -61,6 +62,7 @@ def int_or_str(value):
VERSION = tuple([99, 99, 99])

__all__ = [
"_LocalChace",
"AuthenticationError",
"AuthenticationWrongNumberOfArgsError",
"BlockingConnectionPool",
Expand Down
10 changes: 8 additions & 2 deletions redis/_parsers/hiredis.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,16 @@ async def read_response(
if not self._connected:
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None

response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()
while response is False:
await self.read_from_socket()
response = self._reader.gets()
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()

# if the response is a ConnectionError or the response is a list and
# the first item is a ConnectionError, raise it as something bad
Expand Down
2 changes: 2 additions & 0 deletions redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ async def _disconnect_raise(self, conn: Connection, error: Exception):
async def execute_command(self, *args, **options):
"""Execute a command and return a parsed response"""
await self.initialize()
options.pop("keys", None) # the keys are used only for client side caching
pool = self.connection_pool
command_name = args[0]
conn = self.connection or await pool.get_connection(command_name, **options)
Expand Down Expand Up @@ -1275,6 +1276,7 @@ def multi(self):
def execute_command(
self, *args, **kwargs
) -> Union["Pipeline", Awaitable["Pipeline"]]:
kwargs.pop("keys", None) # the keys are used only for client side caching
if (self.watching or args[0] == "WATCH") and not self.explicit_transaction:
return self.immediate_execute_command(*args, **kwargs)
return self.pipeline_execute_command(*args, **kwargs)
Expand Down
2 changes: 2 additions & 0 deletions redis/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,7 @@ async def execute_command(self, *args: EncodableT, **kwargs: Any) -> Any:
:raises RedisClusterException: if target_nodes is not provided & the command
can't be mapped to a slot
"""
kwargs.pop("keys", None) # the keys are used only for client side caching
command = args[0]
target_nodes = []
target_nodes_specified = False
Expand Down Expand Up @@ -1447,6 +1448,7 @@ def execute_command(
or List[:class:`~.ClusterNode`] or Dict[Any, :class:`~.ClusterNode`]
- Rest of the kwargs are passed to the Redis connection
"""
kwargs.pop("keys", None) # the keys are used only for client side caching
self._command_stack.append(
PipelineCommand(len(self._command_stack), *args, **kwargs)
)
Expand Down
1 change: 1 addition & 0 deletions redis/asyncio/sentinel.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ async def execute_command(self, *args, **kwargs):
once - If set to True, then execute the resulting command on a single
node at random, rather than across the entire sentinel cluster.
"""
kwargs.pop("keys", None) # the keys are used only for client side caching
once = bool(kwargs.get("once", False))
if "once" in kwargs.keys():
kwargs.pop("once")
Expand Down
Loading

0 comments on commit a21dc50

Please sign in to comment.