Skip to content
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

Added retry mechanism on socket timeouts when connecting to the server #1895

Merged
merged 2 commits into from Jan 25, 2022

Conversation

barshaul
Copy link
Contributor

@barshaul barshaul commented Jan 23, 2022

Pull Request check-list

Please make sure to review and check all of these items:

  • Does $ tox pass with this change (including linting)?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

The current option to add retry object for timeouts works only at the execute command level and do not apply to the socket timeouts that may occur when trying to connect to the server.
Added support for retrying on timeout to connection::connect function.

Closes #1833

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2022

Codecov Report

Merging #1895 (8f6d4d4) into master (90295ea) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1895      +/-   ##
==========================================
+ Coverage   92.97%   93.01%   +0.03%     
==========================================
  Files          76       76              
  Lines       16389    16425      +36     
==========================================
+ Hits        15237    15277      +40     
+ Misses       1152     1148       -4     
Impacted Files Coverage Δ
redis/connection.py 87.02% <100.00%> (+0.24%) ⬆️
redis/retry.py 100.00% <100.00%> (ø)
tests/test_connection.py 98.87% <100.00%> (+0.72%) ⬆️
tests/test_cluster.py 98.28% <0.00%> (+0.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d23974...8f6d4d4. Read the comment docs.

import types
from unittest import mock
from unittest.mock import patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So happy :D

@chayim chayim added bug Bug feature New feature and removed bug Bug labels Jan 25, 2022
@chayim chayim merged commit 0392576 into redis:master Jan 25, 2022
@chayim chayim deleted the retry_timeout branch January 25, 2022 07:01
dvora-h pushed a commit to dvora-h/redis-py that referenced this pull request Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: resolving hostname when retry on connection timeout
3 participants