-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass socket_keepalive_options to redis client for result_backend #8297
base: main
Are you sure you want to change the base?
Changes from all commits
1253610
8d0b6f7
b743579
784981a
063bd57
9b540d3
5f9c1d5
ce4580d
1e2cf86
e6764e4
dc71d74
20d9bd6
51d8b7d
5b6983d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,16 +218,19 @@ def __init__(self, host=None, port=None, db=None, password=None, | |
if host and '://' in host: | ||
url, host = host, None | ||
|
||
self.max_connections = ( | ||
max_connections or | ||
_get('redis_max_connections') or | ||
self.max_connections) | ||
if max_connections is not None: | ||
self.max_connections = max_connections | ||
elif _get('redis_max_connections') is not None: | ||
self.max_connections = _get('redis_max_connections') | ||
else: | ||
self.max_connections = self.max_connections | ||
self._ConnectionPool = connection_pool | ||
|
||
socket_timeout = _get('redis_socket_timeout') | ||
socket_connect_timeout = _get('redis_socket_connect_timeout') | ||
retry_on_timeout = _get('redis_retry_on_timeout') | ||
socket_keepalive = _get('redis_socket_keepalive') | ||
socket_keepalive_options = self._transport_options.get('socket_keepalive_options', {}) | ||
health_check_interval = _get('redis_backend_health_check_interval') | ||
|
||
self.connparams = { | ||
|
@@ -259,6 +262,8 @@ def __init__(self, host=None, port=None, db=None, password=None, | |
# absent in redis.connection.UnixDomainSocketConnection | ||
if socket_keepalive: | ||
self.connparams['socket_keepalive'] = socket_keepalive | ||
if socket_keepalive_options: | ||
self.connparams['socket_keepalive_options'] = socket_keepalive_options | ||
|
||
# "redis_backend_use_ssl" must be a dict with the keys: | ||
# 'ssl_cert_reqs', 'ssl_ca_certs', 'ssl_certfile', 'ssl_keyfile' | ||
|
@@ -453,7 +458,7 @@ def apply_chord(self, header_result_args, body, **kwargs): | |
def _chord_zset(self): | ||
return self._transport_options.get('result_chord_ordered', True) | ||
|
||
@cached_property | ||
@property | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you sure about this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I have this cached_property 4 test are doing to failure: ======================================================================= short test summary info ========================================================================
FAILED t/unit/backends/test_redis.py::test_RedisBackend_chords_simple::test_on_chord_part_return__unordered - AssertionError: assert 0
FAILED t/unit/backends/test_redis.py::test_RedisBackend_chords_simple::test_on_chord_part_return_no_expiry__unordered - AssertionError: assert 0
FAILED t/unit/backends/test_redis.py::test_RedisBackend_chords_simple::test_on_chord_part_return__ChordError__unordered - TypeError: '_ContextMock' object is not subscriptable
FAILED t/unit/backends/test_redis.py::test_RedisBackend_chords_simple::test_on_chord_part_return__other_error__unordered - TypeError: '_ContextMock' object is not subscriptable
=============================================================== 4 failed, 82 passed in 63.34s (0:01:03) ================================================================ Its looks like _transport_options is setup once and every test use it (doesn't update their custom setup).
Maybe something I have missed or I haven't know and any advice how to fix will be welcome and I change if back :) |
||
def _transport_options(self): | ||
return self.app.conf.get('result_backend_transport_options', {}) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we document this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have this description for those parameters and the rest parameters are in code they aren't described either.
So I haven't described it as well. So the question is: should I be highlighted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at least New in version 5.4. annotation?