-
Notifications
You must be signed in to change notification settings - Fork 3
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
57 changing the cluster conn function to use domain nameshostnames instead of ips #58
base: main
Are you sure you want to change the base?
Changes from 2 commits
534723e
eff9ae8
3fd5c14
e5cfe80
377fae2
eef67b8
e65ee26
97bbe4a
0e79477
98719f6
f65ce34
f623557
427ef70
523ff53
8509151
09c969a
da45121
14580bc
ac39f29
c074f70
adbbada
670e908
af46b2b
d795189
d05f644
343f0c0
a43db2e
674c651
4c485b4
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
from redis.cluster import RedisCluster | ||
from redis.cluster import RedisCluster, ClusterNode | ||
from redis.retry import Retry | ||
from redis.backoff import default_backoff | ||
|
||
# detect if a connection is a sentinel | ||
def Is_Cluster(conn): | ||
|
@@ -7,12 +9,10 @@ | |
|
||
# create a cluster connection from a Redis connection | ||
def Cluster_Conn(conn, ssl): | ||
# current sentinel | ||
info = conn.execute_command("CLUSTER NODES") | ||
nodes = [ ClusterNode(v['hostname'],k.split(':')[1]) for k,v in info.items()] | ||
connection_kwargs = conn.connection_pool.connection_kwargs | ||
host = connection_kwargs['host'] | ||
port = connection_kwargs['port'] | ||
username = connection_kwargs['username'] | ||
password = connection_kwargs['password'] | ||
|
||
return RedisCluster(host=host, port=port, username=username, password=password, ssl=ssl) | ||
return RedisCluster(Retry(default_backoff(),6),cluster_error_retry_attempts=6,startup_nodes=nodes,username=username,password=password,ssl=ssl) | ||
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. Significant improvements in The modifications to use the However, as indicated by static analysis tools and previous comments, these changes are not covered by unit tests. It is crucial to ensure that new functionalities work as expected and do not introduce regressions. Would you like me to help by generating the unit testing code or opening a GitHub issue to track this task? |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ packages = [{include = "falkordb"}] | |
|
||
[tool.poetry.dependencies] | ||
python = "^3.8" | ||
redis = "^5.0.1" | ||
redis = {git = "https://github.com/redis/redis-py", rev = "master"} | ||
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. Consider the implications of using the master branch for the Redis dependency. Switching the Redis dependency to the master branch of its Git repository can introduce instability due to the inclusion of potentially untested changes. It's generally safer to depend on a specific release or a stable branch to ensure compatibility and stability of the application. Consider using a tagged release or a stable branch instead of the master branch: -redis = {git = "https://github.com/redis/redis-py", rev = "master"}
+redis = {git = "https://github.com/redis/redis-py", rev = "stable"}
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. I need to wait for an official release from redis. 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. @MuhammadQadora, understood! Once the official release from Redis is available, we can revisit the dependency to ensure stability. Let me know if you need any further assistance in the meantime! |
||
|
||
[tool.poetry.group.test.dependencies] | ||
pytest-cov = ">=4.1,<6.0" | ||
|
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.
Implement retry mechanism in the
Cluster_Conn
function.The addition of a retry mechanism using
Retry
with a default backoff strategy enhances the resilience of the connection process. This is a good practice for distributed systems where transient errors are common. However, ensure that the new lines of code are covered by unit tests to maintain code quality and reliability.The static analysis tool indicates that these lines are not covered by tests. Consider adding unit tests to cover these new functionalities.
Tools
GitHub Check: codecov/patch