Skip to content

Commit 7694776

Browse files
Merge branch 'master' into fix_unique_cache_key
2 parents 49b5c45 + 8403ddc commit 7694776

17 files changed

+1298
-44
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: Checkout repository
39-
uses: actions/checkout@v4
39+
uses: actions/checkout@v5
4040

4141
# Initializes the CodeQL tools for scanning.
4242
- name: Initialize CodeQL

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
name: Build docs
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929
- uses: actions/setup-python@v5
3030
with:
3131
python-version: 3.9

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
5454
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
5555
steps:
56-
- uses: actions/checkout@v4
56+
- uses: actions/checkout@v5
5757
with:
5858
ref: ${{ inputs.redis-py-branch }}
5959
- name: Run tests

.github/workflows/install_and_test.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ cd ${TESTDIR}
4040
# install, run tests
4141
pip install ${PKG}
4242
# Redis tests
43-
pytest -m 'not onlycluster'
43+
pytest -m 'not onlycluster' --ignore=tests/test_scenario
4444
# RedisCluster tests
4545
CLUSTER_URL="redis://localhost:16379/0"
4646
CLUSTER_SSL_URL="rediss://localhost:27379/0"
4747
pytest -m 'not onlynoncluster and not redismod and not ssl' \
48-
--redis-url="${CLUSTER_URL}" --redis-ssl-url="${CLUSTER_SSL_URL}"
48+
--ignore=tests/test_scenario \
49+
--redis-url="${CLUSTER_URL}" \
50+
--redis-ssl-url="${CLUSTER_SSL_URL}"

.github/workflows/integration.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
name: Dependency audit
3636
runs-on: ubuntu-latest
3737
steps:
38-
- uses: actions/checkout@v4
38+
- uses: actions/checkout@v5
3939
- uses: pypa/[email protected]
4040
with:
4141
inputs: dev_requirements.txt
@@ -46,7 +46,7 @@ jobs:
4646
name: Code linters
4747
runs-on: ubuntu-latest
4848
steps:
49-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v5
5050
- uses: actions/setup-python@v5
5151
with:
5252
python-version: 3.9
@@ -82,7 +82,7 @@ jobs:
8282
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
8383
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
8484
steps:
85-
- uses: actions/checkout@v4
85+
- uses: actions/checkout@v5
8686
- name: Run tests
8787
uses: ./.github/actions/run-tests
8888
with:
@@ -106,7 +106,7 @@ jobs:
106106
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
107107
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
108108
steps:
109-
- uses: actions/checkout@v4
109+
- uses: actions/checkout@v5
110110
- name: Run tests
111111
uses: ./.github/actions/run-tests
112112
with:
@@ -131,7 +131,7 @@ jobs:
131131
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
132132
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}} (${{ matrix.hiredis-version }}); EL:${{matrix.event-loop}}
133133
steps:
134-
- uses: actions/checkout@v4
134+
- uses: actions/checkout@v5
135135
- name: Run tests
136136
uses: ./.github/actions/run-tests
137137
with:
@@ -156,7 +156,7 @@ jobs:
156156
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
157157
name: Redis ${{ matrix.redis-version }}; Python ${{ matrix.python-version }}; RESP Parser:${{matrix.parser-backend}}; EL:${{matrix.event-loop}}
158158
steps:
159-
- uses: actions/checkout@v4
159+
- uses: actions/checkout@v5
160160
- name: Run tests
161161
uses: ./.github/actions/run-tests
162162
with:
@@ -174,7 +174,7 @@ jobs:
174174
matrix:
175175
extension: ['tar.gz', 'whl']
176176
steps:
177-
- uses: actions/checkout@v4
177+
- uses: actions/checkout@v5
178178
- uses: actions/setup-python@v5
179179
with:
180180
python-version: 3.9
@@ -193,7 +193,7 @@ jobs:
193193
matrix:
194194
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.9', 'pypy-3.10']
195195
steps:
196-
- uses: actions/checkout@v4
196+
- uses: actions/checkout@v5
197197
- uses: actions/setup-python@v5
198198
with:
199199
python-version: ${{ matrix.python-version }}

.github/workflows/pypi-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
build_and_package:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: install python
1818
uses: actions/setup-python@v5
1919
with:

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- name: Checkout
9-
uses: actions/checkout@v4
9+
uses: actions/checkout@v5
1010
- name: Check Spelling
1111
uses: rojopolis/[email protected]
1212
with:

redis/_parsers/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def parse_moving_msg(response):
191191
# Expected message format is: MOVING <seq_number> <time> <endpoint>
192192
id = response[1]
193193
ttl = response[2]
194-
if response[3] in [b"null", "null"]:
194+
if response[3] is None:
195195
host, port = None, None
196196
else:
197197
value = response[3]

redis/connection.py

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,7 +1381,7 @@ def __init__(
13811381
ssl_cert_reqs: The string value for the SSLContext.verify_mode (none, optional, required), or an ssl.VerifyMode. Defaults to "required".
13821382
ssl_ca_certs: The path to a file of concatenated CA certificates in PEM format. Defaults to None.
13831383
ssl_ca_data: Either an ASCII string of one or more PEM-encoded certificates or a bytes-like object of DER-encoded certificates.
1384-
ssl_check_hostname: If set, match the hostname during the SSL handshake. Defaults to False.
1384+
ssl_check_hostname: If set, match the hostname during the SSL handshake. Defaults to True.
13851385
ssl_ca_path: The path to a directory containing several CA certificates in PEM format. Defaults to None.
13861386
ssl_password: Password for unlocking an encrypted private key. Defaults to None.
13871387
@@ -1722,7 +1722,7 @@ def __init__(
17221722
self._cache_factory = cache_factory
17231723

17241724
if connection_kwargs.get("cache_config") or connection_kwargs.get("cache"):
1725-
if connection_kwargs.get("protocol") not in [3, "3"]:
1725+
if self.connection_kwargs.get("protocol") not in [3, "3"]:
17261726
raise RedisError("Client caching is only supported with RESP version 3")
17271727

17281728
cache = self.connection_kwargs.get("cache")
@@ -1743,31 +1743,21 @@ def __init__(
17431743
connection_kwargs.pop("cache", None)
17441744
connection_kwargs.pop("cache_config", None)
17451745

1746-
if connection_kwargs.get(
1746+
if self.connection_kwargs.get(
17471747
"maintenance_events_pool_handler"
1748-
) or connection_kwargs.get("maintenance_events_config"):
1749-
if connection_kwargs.get("protocol") not in [3, "3"]:
1748+
) or self.connection_kwargs.get("maintenance_events_config"):
1749+
if self.connection_kwargs.get("protocol") not in [3, "3"]:
17501750
raise RedisError(
17511751
"Push handlers on connection are only supported with RESP version 3"
17521752
)
1753-
config = connection_kwargs.get("maintenance_events_config", None) or (
1754-
connection_kwargs.get("maintenance_events_pool_handler").config
1755-
if connection_kwargs.get("maintenance_events_pool_handler")
1753+
config = self.connection_kwargs.get("maintenance_events_config", None) or (
1754+
self.connection_kwargs.get("maintenance_events_pool_handler").config
1755+
if self.connection_kwargs.get("maintenance_events_pool_handler")
17561756
else None
17571757
)
17581758

17591759
if config and config.enabled:
1760-
connection_kwargs.update(
1761-
{
1762-
"orig_host_address": connection_kwargs.get("host"),
1763-
"orig_socket_timeout": connection_kwargs.get(
1764-
"socket_timeout", None
1765-
),
1766-
"orig_socket_connect_timeout": connection_kwargs.get(
1767-
"socket_connect_timeout", None
1768-
),
1769-
}
1770-
)
1760+
self._update_connection_kwargs_for_maintenance_events()
17711761

17721762
self._event_dispatcher = self.connection_kwargs.get("event_dispatcher", None)
17731763
if self._event_dispatcher is None:
@@ -1823,6 +1813,7 @@ def set_maintenance_events_pool_handler(
18231813
"maintenance_events_config": maintenance_events_pool_handler.config,
18241814
}
18251815
)
1816+
self._update_connection_kwargs_for_maintenance_events()
18261817

18271818
self._update_maintenance_events_configs_for_connections(
18281819
maintenance_events_pool_handler
@@ -1840,6 +1831,23 @@ def _update_maintenance_events_configs_for_connections(
18401831
conn.set_maintenance_event_pool_handler(maintenance_events_pool_handler)
18411832
conn.maintenance_events_config = maintenance_events_pool_handler.config
18421833

1834+
def _update_connection_kwargs_for_maintenance_events(self):
1835+
"""Store original connection parameters for maintenance events."""
1836+
if self.connection_kwargs.get("orig_host_address", None) is None:
1837+
# If orig_host_address is None it means we haven't
1838+
# configured the original values yet
1839+
self.connection_kwargs.update(
1840+
{
1841+
"orig_host_address": self.connection_kwargs.get("host"),
1842+
"orig_socket_timeout": self.connection_kwargs.get(
1843+
"socket_timeout", None
1844+
),
1845+
"orig_socket_connect_timeout": self.connection_kwargs.get(
1846+
"socket_connect_timeout", None
1847+
),
1848+
}
1849+
)
1850+
18431851
def reset(self) -> None:
18441852
self._created_connections = 0
18451853
self._available_connections = []

redis/maintenance_events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def __init__(
449449
self,
450450
enabled: bool = True,
451451
proactive_reconnect: bool = True,
452-
relax_timeout: Optional[Number] = 20,
452+
relax_timeout: Optional[Number] = 10,
453453
endpoint_type: Optional[EndpointType] = None,
454454
):
455455
"""

0 commit comments

Comments
 (0)