Repository navigation
Conversation
There was a problem hiding this comment.
🔍 Devin Review: 9 flags
Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
The feature server scheduled the next registry refresh only after the current one succeeded. A single transient error from the registry backend (for example an SSL error while downloading an S3 registry) ended the timer thread, and the worker kept serving its cached registry without refreshing it again until restart. Catch and log errors in the periodic refresh and always schedule the next attempt. The first refresh still runs in the app lifespan and fails startup on error, as before. Scheduling a timer and stopping refreshes at shutdown now hold the same lock. Before, shutdown could cancel the previous timer while a refresh was scheduling the next one, and the new timer then kept the process waiting for one more interval. Signed-off-by: Youngbeom Choi <helloybz@gmail.com>
0dad9b9 to
16f51b3
Compare
Signed-off-by: Youngbeom Choi <helloybz@gmail.com>
franciscojavierarceo
left a comment
There was a problem hiding this comment.
the periodic path now logs refresh failures and schedules the next attempt, while the lifespan still propagates the first refresh failure. the shared scheduling/shutdown lock cancels the newest timer. the three new tests exercise recovery, startup failure, and concurrent shutdown using the real file-registry/SQLite store fixture.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7219 +/- ##
==========================================
+ Coverage 54.10% 54.14% +0.03%
==========================================
Files 467 467
Lines 58940 58951 +11
Branches 8688 8688
==========================================
+ Hits 31890 31919 +29
+ Misses 24892 24868 -24
- Partials 2158 2164 +6
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
What this PR does / why we need it:
The feature server refreshes its registry on a timer (
async_refresh()inget_app()). The nextthreading.Timerwas scheduled only afterstore.refresh_registry()andvs_registry.refresh()both succeeded. A single transient error from the registry backend, such as anssl.SSLErrorwhile downloading an S3 registry, ended the timer thread without scheduling another. The worker stayed up and kept serving its cached registry, but it never refreshed the registry again until it was restarted. The only trace was the traceback that Python prints for an uncaught exception in a thread; nothing reported that refreshes had stopped.async_refresh()is split intorefresh_registry_caches(),schedule_refresh()andperiodic_refresh(). The periodic refresh now logs the error and always schedules the next attempt, so the worker keeps serving the cached registry and retries on the next cycle. The first refresh still runs in the app lifespan and still fails startup on error, so startup behavior does not change. Scheduling a timer and stopping refreshes at shutdown now hold the same lock, so shutdown always cancels the latest timer, including one that a refresh is scheduling at that moment. Before, shutdown could cancel the previous timer while the next one was being created, and the new timer kept the process waiting for one more interval.Only
get_app()infeature_server.pychanges.Which issue(s) this PR fixes:
No existing issue. I searched open and closed issues and PRs for
async_refreshand the registry refresh timer. #7065 also changesfeature_server.py(a Gunicornpost_forkhook) but does not overlap with this change.Checks
git commit -s)Testing Strategy
New tests in
sdk/python/tests/unit/test_feature_server.py.threading.Timeris patched so each test can fire the scheduled refresh by hand:test_periodic_registry_refresh_keeps_running_after_a_failure: a refresh that raises still schedules the next one, and the error is logged. Fails on master with theRuntimeErrorraised from the timer callback.test_registry_refresh_failure_at_startup_still_fails_startup: a failed first refresh still fails app startup, and no timer is scheduled. Passes on master too; it pins the startup behavior.test_registry_refresh_timer_scheduled_during_shutdown_is_cancelled: the app shuts down while a refresh is creating the next timer, and that timer must be cancelled. Fails without the lock: only the previous timer is cancelled.make test-python-unitpasses locally (4462 passed, 37 skipped), andruff check,ruff formatandmypyare clean on the changed files.Misc
This change was written with help from an AI assistant (Claude Code). I reviewed it and ran the tests above.
🤖 Generated with Claude Code