Skip to content

Commit 78be4c3

Browse files
authored
Merge branch 'master' into ps_remove_sync_context_manager_from_async_cluster
2 parents cb30482 + 23422c1 commit 78be4c3

21 files changed

+58
-58
lines changed

.github/actions/run-tests/action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ runs:
7373
7474
# Mapping of redis version to stack version
7575
declare -A redis_stack_version_mapping=(
76-
["7.4.2"]="rs-7.4.0-v2"
77-
["7.2.7"]="rs-7.2.0-v14"
76+
["7.4.4"]="rs-7.4.0-v5"
77+
["7.2.9"]="rs-7.2.0-v17"
7878
)
7979
8080
if [[ -v redis_stack_version_mapping[$REDIS_VERSION] ]]; then
@@ -91,8 +91,10 @@ runs:
9191
fi
9292
9393
invoke devenv --endpoints=all-stack
94+
9495
else
9596
echo "Using redis CE for module tests"
97+
export CLIENT_LIBS_TEST_STACK_IMAGE_TAG=$REDIS_VERSION
9698
echo "REDIS_MOD_URL=redis://127.0.0.1:6379" >> $GITHUB_ENV
9799
invoke devenv --endpoints all
98100
fi

.github/workflows/hiredis-py-integration.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ env:
2323
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2424
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
2525
COVERAGE_CORE: sysmon
26-
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
27-
CURRENT_REDIS_VERSION: '7.4.2'
26+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: '8.0.2'
27+
CURRENT_REDIS_VERSION: '8.0.2'
2828

2929
jobs:
3030
redis_version:

.github/workflows/integration.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ env:
2727
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2828
# this speeds up coverage with Python 3.12: https://github.com/nedbat/coveragepy/issues/1665
2929
COVERAGE_CORE: sysmon
30-
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: 'rs-7.4.0-v2'
31-
CURRENT_REDIS_VERSION: '7.4.2'
30+
CURRENT_CLIENT_LIBS_TEST_STACK_IMAGE_TAG: '8.0.2'
31+
CURRENT_REDIS_VERSION: '8.0.2'
3232

3333
jobs:
3434
dependency-audit:
@@ -74,7 +74,7 @@ jobs:
7474
max-parallel: 15
7575
fail-fast: false
7676
matrix:
77-
redis-version: ['8.0.1-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.2.7']
77+
redis-version: ['8.2-M01-pre', '${{ needs.redis_version.outputs.CURRENT }}', '7.4.4', '7.2.9']
7878
python-version: ['3.9', '3.13']
7979
parser-backend: ['plain']
8080
event-loop: ['asyncio']

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
# image tag 8.0-RC2-pre is the one matching the 8.0 GA release
33
x-client-libs-stack-image: &client-libs-stack-image
4-
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-8.0-RC2-pre}"
4+
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_STACK_IMAGE_TAG:-8.0.2}"
55

66
x-client-libs-image: &client-libs-image
7-
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-8.0-RC2-pre}"
7+
image: "redislabs/client-libs-test:${CLIENT_LIBS_TEST_IMAGE_TAG:-8.0.2}"
88

99
services:
1010

redis/client.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,7 @@ def __init__(
368368
]:
369369
raise RedisError("Client caching is only supported with RESP version 3")
370370

371-
# TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
372-
# TODO: Remove this before next major version (7.0.0)
373-
self.single_connection_lock = threading.Lock()
371+
self.single_connection_lock = threading.RLock()
374372
self.connection = None
375373
self._single_connection_client = single_connection_client
376374
if self._single_connection_client:
@@ -776,9 +774,7 @@ def __init__(
776774
else:
777775
self._event_dispatcher = event_dispatcher
778776

779-
# TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
780-
# TODO: Remove this before next major version (7.0.0)
781-
self._lock = threading.Lock()
777+
self._lock = threading.RLock()
782778
if self.encoder is None:
783779
self.encoder = self.connection_pool.get_encoder()
784780
self.health_check_response_b = self.encoder.encode(self.HEALTH_CHECK_MESSAGE)

redis/commands/search/aggregation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Reducer:
2626

2727
NAME = None
2828

29-
def __init__(self, *args: List[str]) -> None:
29+
def __init__(self, *args: str) -> None:
3030
self._args = args
3131
self._field = None
3232
self._alias = None
@@ -116,7 +116,7 @@ def __init__(self, query: str = "*") -> None:
116116
self._add_scores = False
117117
self._scorer = "TFIDF"
118118

119-
def load(self, *fields: List[str]) -> "AggregateRequest":
119+
def load(self, *fields: str) -> "AggregateRequest":
120120
"""
121121
Indicate the fields to be returned in the response. These fields are
122122
returned in addition to any others implicitly specified.
@@ -223,7 +223,7 @@ def limit(self, offset: int, num: int) -> "AggregateRequest":
223223
self._aggregateplan.extend(_limit.build_args())
224224
return self
225225

226-
def sort_by(self, *fields: List[str], **kwargs) -> "AggregateRequest":
226+
def sort_by(self, *fields: str, **kwargs) -> "AggregateRequest":
227227
"""
228228
Indicate how the results should be sorted. This can also be used for
229229
*top-N* style queries

redis/commands/search/commands.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def explain_cli(self, query: Union[str, Query]): # noqa
542542

543543
def aggregate(
544544
self,
545-
query: Union[str, Query],
545+
query: Union[AggregateRequest, Cursor],
546546
query_params: Dict[str, Union[str, int, float]] = None,
547547
):
548548
"""
@@ -573,7 +573,7 @@ def aggregate(
573573
)
574574

575575
def _get_aggregate_result(
576-
self, raw: List, query: Union[str, Query, AggregateRequest], has_cursor: bool
576+
self, raw: List, query: Union[AggregateRequest, Cursor], has_cursor: bool
577577
):
578578
if has_cursor:
579579
if isinstance(query, Cursor):
@@ -967,7 +967,7 @@ async def search(
967967

968968
async def aggregate(
969969
self,
970-
query: Union[str, Query],
970+
query: Union[AggregateResult, Cursor],
971971
query_params: Dict[str, Union[str, int, float]] = None,
972972
):
973973
"""

redis/connection.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ def __init__(
810810
self,
811811
conn: ConnectionInterface,
812812
cache: CacheInterface,
813-
pool_lock: threading.Lock,
813+
pool_lock: threading.RLock,
814814
):
815815
self.pid = os.getpid()
816816
self._conn = conn
@@ -1422,13 +1422,7 @@ def __init__(
14221422
# release the lock.
14231423

14241424
self._fork_lock = threading.RLock()
1425-
1426-
if self.cache is None:
1427-
self._lock = threading.RLock()
1428-
else:
1429-
# TODO: To avoid breaking changes during the bug fix, we have to keep non-reentrant lock.
1430-
# TODO: Remove this before next major version (7.0.0)
1431-
self._lock = threading.Lock()
1425+
self._lock = threading.RLock()
14321426

14331427
self.reset()
14341428

redis/event.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(
152152
self,
153153
connection,
154154
client_type: ClientType,
155-
connection_lock: Union[threading.Lock, asyncio.Lock],
155+
connection_lock: Union[threading.RLock, asyncio.Lock],
156156
):
157157
self._connection = connection
158158
self._client_type = client_type
@@ -167,7 +167,7 @@ def client_type(self) -> ClientType:
167167
return self._client_type
168168

169169
@property
170-
def connection_lock(self) -> Union[threading.Lock, asyncio.Lock]:
170+
def connection_lock(self) -> Union[threading.RLock, asyncio.Lock]:
171171
return self._connection_lock
172172

173173

@@ -177,7 +177,7 @@ def __init__(
177177
pubsub_connection,
178178
connection_pool,
179179
client_type: ClientType,
180-
connection_lock: Union[threading.Lock, asyncio.Lock],
180+
connection_lock: Union[threading.RLock, asyncio.Lock],
181181
):
182182
self._pubsub_connection = pubsub_connection
183183
self._connection_pool = connection_pool
@@ -197,7 +197,7 @@ def client_type(self) -> ClientType:
197197
return self._client_type
198198

199199
@property
200-
def connection_lock(self) -> Union[threading.Lock, asyncio.Lock]:
200+
def connection_lock(self) -> Union[threading.RLock, asyncio.Lock]:
201201
return self._connection_lock
202202

203203

tests/test_asyncio/compat.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
import asyncio
2-
from unittest import mock
3-
4-
try:
5-
mock.AsyncMock
6-
except AttributeError:
7-
from unittest import mock
82

93
try:
104
from contextlib import aclosing

0 commit comments

Comments
 (0)