feat(archon): rebuild-class config supervisors for scanner and feeds (#529 step 6) - #586
Merged
Conversation
…529) Gate-Passed: kanon 0.1.5 +stages:fmt,check,clippy,nextest,lint sha:958298c9d2c10ce97d21734efe62c6516ead80b5
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.
Step 6 of the #529 reactive-config migration — the two rebuild-class subsystems (library scanner and feed scheduler) now reconfigure live on a config reload instead of only at startup.
Both follow the supervisor pattern established in steps 4-5: a spawned archon task owns the subsystem from boot, watches its config section via
SectionWatcher, and on a change tears the old instance down and rebuilds it from the new config.run_scanner_supervisorwatchestaxis.*. On change:ScannerManager::shutdown().await(joins all scan tasks) →ScannerManager::start(&new_taxis, event_tx). kathodos is safe to rebuild wholesale (no statics; fresh channels/semaphore perstart). In-flight scans abort via kathodos's existing shutdown-yield and re-run on the next interval of the new instance.run_feed_supervisorwatcheskomide.*. On change:FeedScheduler::shutdown()→start_feed_scheduler(rebuilds the bounded reqwest client, a newFeedSchedulerService— which owns its ownKomideConfig, so the scheduler alone isn't enough — andFeedScheduler::start).rebuild_with_rollbackstate machine: on a rebuildstartfailure it attempts a rollback to the previous config; if that also fails the subsystem stays down with a louderror!and the server keeps serving (never panics). The helper is unit-tested directly with injected closures.run_serve; each supervisor is spawned with ashutdown_token.child_token()and performs its own final teardown when the token cancels.run_serve's cleanup now.awaits the two supervisorJoinHandles (feed then scanner, preserving prior order) instead of calling.shutdown()directly.A NOTE on the feeds path records that a rebuild re-pages feed rows from the DB (so a feed subscribed since boot gets a poll loop after a rebuild) — this is a side effect, not the fix for the runtime-subscribe defect (#577), which stays open.
Small introspection accessors added for tests:
ScannerManager::scan_concurrency(),FeedScheduler::task_count().Tests (real
ConfigManager/Section) prove the watch→rebuild→shutdown loop runs end-to-end and that the rebuilt instance reflects the new config (viatrigger_scan/ DB re-paging), with no timing dependency. (Two initialstart_pauseddesigns were flaky — sqlxPoolTimedOutunder paused time, and a notify watcher defeating the auto-advance — so they were redesigned around robust non-timing patterns.)Gate:
kanon gate --fullgreen — fmt, check, clippy (-D warnings), nextest 416 (archon+kathodos+komide) / full workspace, deny, kanon lint (0/0).Gate-Passedstamped.Refs #529