Repository navigation
Retry transient Neon search failures in neongetter; bump to 0.15.1 - #205
Merged
Merged
Conversation
neongetter runs every 15 minutes and failed about 12 times between 2026-11-16 and 11-20 (11 read timeouts, 1 HTTP 500 from /v2/accounts/search). The next run always succeeded, but each failure marked the systemd unit failed and fired a "Failed Systemd Units" alert. The account search POST in _get_users_page now goes through a new _post_search helper that retries connection errors, timeouts and HTTP 429/5xx, up to 3 total attempts with linear backoff (10s, then 20s). Other 4xx responses are not retried. Each retry is logged at WARNING. After the last attempt the exception is raised (or the last response is returned so raise_for_status() fails as before), so a real outage still fails the unit. Worst case added time is 30s of sleep plus the extra 30s read timeouts, far below the 15-minute timer interval. The search is a read-only query, so repeating the POST is safe. The existing HTTPAdapter(max_retries=3) only retries connection failures, never read timeouts or status codes, so it is left alone. A urllib3 Retry was not used because the tests mock HTTP with `responses`, which bypasses the adapter, and a plain loop also allows WARNING logs. Adds unit tests for retry-then-succeed (timeout then 500), HTTP 429, exhausted timeouts, exhausted 500, and a non-retried 403. The repo has no CHANGELOG and bumps the version in separate commits, so neither is touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KQ8DrMbV7veQfdQT7K6tD1
There was a problem hiding this comment.
Claude Code review
From Claude, via the Claude PR Review workflow -- hence github-actions[bot].
Adds retry with linear backoff for the Neon account search POST in neongetter, plus tests and a version bump. The logic looks correct; no issues found.
No issues found. Checked for bugs and CLAUDE.md compliance.
🔎 10s · 5 turns · $0.1067 · run log
Coverage Report
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
neongetternow retries transient failures of the Neon CRM account search, so a single slow or failing Neon response no longer marksmac-neongetter.serviceas failed. This PR also bumps the version to 0.15.1, which releases a new image.Why
neongetterruns every 15 minutes. Between 2026-11-16 and 11-20 it failed 12 times:ReadTimeout(read timeout=30) fromapi.neoncrm.com./v2/accounts/search.The next run succeeded every time. Each failure still marked the unit failed and fired a "Failed Systemd Units" alert.
Change
_get_users_pagenow calls_post_search, which makes up to 3 attempts (SEARCH_ATTEMPTS) and sleeps 10s, then 20s, between them (SEARCH_BACKOFF_SEC).requests.ConnectionError,requests.Timeoutand HTTP 429/5xx, logging each retry at WARNING.raise_for_status(), as before.raise_for_status()raises. A real outage still fails the unit.HTTPAdapter(max_retries=3)only retries connection setup, so it is left unchanged.Tests
TestSearchRetryintests/test_neongetter.py, usingresponseswithtime.sleeppatched, covers five cases:HTTPErrorResults:
nox -s tests: 353 passed, withneongetter.pyat 99% coverage.nox -s pre-commitandnox -s mypyboth pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01KQ8DrMbV7veQfdQT7K6tD1