librenms icon indicating copy to clipboard operation
librenms copied to clipboard

Throttle dispatcher service's redis reconnection rate

Open jwestfall69 opened this issue 1 year ago • 3 comments

The dispatcher service can enter a state where its trying to connect to the redis service 1000's of times a second if the redis port is returning connection refused.

This PR makes use of the python redis module's built-in backoff/retry logic to rate limit reconnections to once every 2 seconds (per thread) and will retry the current redis action 5 times before throwing an exception.

Fixes #16513

DO NOT DELETE THE UNDERLYING TEXT

Please note

Please read this information carefully. You can run ./lnms dev:check to check your code before submitting.

  • [X] Have you followed our code guidelines?
  • [ ] If my Pull Request does some changes/fixes/enhancements in the WebUI, I have inserted a screenshot of it.
  • [ ] If my Pull Request makes discovery/polling/yaml changes, I have added/updated test data.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926 After you are done testing, you can remove the changes with ./scripts/github-remove. If there are schema changes, you can ask on discord how to revert.

jwestfall69 avatar Oct 11 '24 16:10 jwestfall69

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Oct 11 '24 16:10 CLAassistant

Hrm, guess I need some guidance here. Running the lint check locally says there were no issues, but the PR job says there are?

librenms@scratch:~$ ./lnms dev:check
Running Python lint check... 
success (2.62s)
Style check skipped.
Unit check skipped.

jwestfall69 avatar Oct 11 '24 16:10 jwestfall69

CI uses python black which is very aggressive with python formatting. The local check does not use that.

murrant avatar Oct 11 '24 18:10 murrant

As someone that had once had a redis pop generate an insane amount of logging this looks awesome 🙏

peejaychilds avatar Mar 21 '25 06:03 peejaychilds