python-driver icon indicating copy to clipboard operation
python-driver copied to clipboard

Make guard to have only one pending reconnect on control connection

Open dkropachev opened this issue 11 months ago • 0 comments

ControlConnection.reconnect could be called from many places in parallel. When it happens you get to see streak for reconnects happning one by one and, in some cases, even in parallel. This commit adds guard that makes sure there is only one pending control connection reconnect.

Old implementation via _ControlReconnectionHandler had following problems:

  1. Did not rewind schedule, effectively stoping reconnection attempts when schedule is exhausted.
  2. Did not provide good API to rewind schedule when it is exhausted.
  3. Did not allow tight control when reconnection stops.
  4. Had convoluted code with no benefits

Pre-review checklist

  • [x] I have split my patch into logically separate commits.
  • [x] All commit messages clearly explain what they change and why.
  • [ ] ~~I added relevant tests for new features and bug fixes.~~
  • [x] All commits compile, pass static checks and pass test.
  • [x] PR description sums up the changes and reasons why they should be introduced.
  • [ ] ~~I have provided docstrings for the public items that I want to introduce.~~
  • [ ] ~~I have adjusted the documentation in ./docs/source/.~~
  • [ ] ~~I added appropriate Fixes: annotations to PR description.~~

dkropachev avatar Mar 29 '25 14:03 dkropachev