-
Notifications
You must be signed in to change notification settings - Fork 48
Add support for when cluster endpoint is not available #17
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
Add support for when cluster endpoint is not available #17
Conversation
Modify `get_cluster_info` to include a timeout (defaults to 3 seconds) and gracefully degrade when the ElastiCache cluster configuration endpoint isn't available by returning the provided `host` and `port` in the `nodes` list. I also added an additional test to the protocol test suite to cover the additional functionality.
Make use of Telnet.expect() to match against the success (END) and failure case (ERROR) in the same call. Update protocol tests to handle patching expect() with output that was previously returned by read_until().
Conditionally ignore failures to `config get cluster` calls against the configured LOCATION endpoint with the introduction of a `IGNORE_CLUSTER_ERRORS` option (that defaults to `False`).
gusdan
left a comment
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.
Looks good. Just few changes.
django_elasticache/cluster_utils.py
Outdated
|
|
||
|
|
||
| def get_cluster_info(host, port): | ||
| def get_cluster_info(host, port, timeout=3): |
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.
let's remove timeouts or use default timeout from cache configuration setting
django_elasticache/memcached.py
Outdated
| 'tcp_nodelay': True, | ||
| 'ketama': True | ||
| 'ketama': True, | ||
| 'IGNORE_CLUSTER_ERRORS': False, |
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.
i don't think we should pass IGNORE_CLUSTER_ERRORS to parent class (pylibmc)
django_elasticache/cluster_utils.py
Outdated
|
|
||
|
|
||
| def get_cluster_info(host, port): | ||
| def get_cluster_info(host, port, ignore_cluster_errors=False, timeout=3): |
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.
let's remove timeout.
|
I believe that all of your comments have been addressed. |
gusdan
left a comment
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.
looks good
|
Thanks, @gusdan! |
Modify
get_cluster_infoto include a timeout (defaults to 3 seconds) and match against the success (END) and failure case (ERROR) in the same call. From there, gracefully degrade (only if theIGNORE_CLUSTER_ERRORSoption isTrue) when the ElastiCache cluster configuration endpoint isn't available by returning the providedhostandportin thenodeslist.Also, add two additional tests to the protocol test suite to cover the additional functionality.
Fixes #16
Testing
These tests were executed within a Python 2.7 Docker container with all of the necessary dependencies. Let me know if you'd like that setup in a separate PR.