Skip to content

Commit

Permalink
Remove arbitrary defaults for redis sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
alisaifee committed May 16, 2023
1 parent 8ac39b0 commit 0a5d531
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
7 changes: 0 additions & 7 deletions limits/aio/storage/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ class RedisSentinelStorage(RedisStorage):
STORAGE_SCHEME = ["async+redis+sentinel"]
"""The storage scheme for redis accessed via a redis sentinel installation"""

DEFAULT_OPTIONS: Dict[str, Union[float, str, bool]] = {
"stream_timeout": 0.2,
}
"Default options passed to :class:`~coredis.sentinel.Sentinel`"

DEPENDENCIES = {"coredis.sentinel": Version("3.4.0")}

def __init__(
Expand Down Expand Up @@ -402,8 +397,6 @@ def __init__(
if self.service_name is None:
raise ConfigurationError("'service_name' not provided")

connection_options.setdefault("stream_timeout", 0.2)

super(RedisStorage, self).__init__()

self.dependency = self.dependencies["coredis.sentinel"].module
Expand Down
7 changes: 1 addition & 6 deletions limits/storage/redis_sentinel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ class RedisSentinelStorage(RedisStorage):
STORAGE_SCHEME = ["redis+sentinel"]
"""The storage scheme for redis accessed via a redis sentinel installation"""

DEFAULT_OPTIONS: Dict[str, Union[float, str, bool]] = {
"socket_timeout": 0.2,
}
"Default options passed to :class:`~redis.sentinel.Sentinel`"

DEPENDENCIES = {"redis.sentinel": Version("3.0")}

def __init__(
Expand Down Expand Up @@ -79,7 +74,7 @@ def __init__(
self.sentinel: "redis.sentinel.Sentinel" = sentinel_dep.Sentinel(
sentinel_configuration,
sentinel_kwargs={**parsed_auth, **sentinel_options},
**{**self.DEFAULT_OPTIONS, **parsed_auth, **options}
**{**parsed_auth, **options}
)
self.storage = self.sentinel.master_for(self.service_name)
self.storage_slave = self.sentinel.slave_for(self.service_name)
Expand Down

0 comments on commit 0a5d531

Please sign in to comment.