Repository navigation
feat(node): admin_v1_reload alongside SIGHUP hot-reload (#373) - #381
Merged
Merged
Conversation
Expose the same hot-reload path #367 wired to SIGHUP as a JSON-RPC method on the existing local-admin-http surface. Both call RuntimeReloadState::reload(); its internal mutex serialises a SIGHUP racing the RPC, so the two paths queue rather than corrupt state. The RPC takes no params: the node always reloads the file path it was started with (admin_v1_reload would otherwise let an operator script swap in a different config without a restart, which is out of scope for the SIGHUP-equivalent semantics this method advertises). - `CONFIG_PATH_UNSET_CODE` (-32_003) when the node was started without --config; nothing on disk to re-read. - `RELOAD_ERROR_CODE` (-32_004) when the underlying reload fails; previous values retained, mirroring the SIGHUP "best-effort" contract. - On success: `{rate_per_mb, log_level}` so operator scripts can confirm the post-reload state without scraping logs. CLI ride-along: `decdn node reload` calls the RPC and prints two grep-friendly lines (or --json), matching the `decdn node health` shape. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request introduces the admin_v1_reload RPC method and a matching decdn node reload CLI command, allowing operators to hot-reload configuration fields such as payment.rate_per_mb and observability.log_level via JSON-RPC. The implementation integrates a ReloadHook into the admin state and ensures consistency between RPC-triggered reloads and SIGHUP signals. I have no feedback to provide.
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.
Summary
admin_v1_reloadon the existingadmin_v1namespace; calls the sameRuntimeReloadState::reloadSIGHUP uses, so both paths share the internal mutex (a SIGHUP racing the RPC waits behind it).-32_003 CONFIG_PATH_UNSET(node was started without--config, nothing on disk to re-read) and-32_004 RELOAD_ERROR(parse/resolve/setter failure; previous values retained per the SIGHUP contract).{rate_per_mb, log_level}so operator scripts confirm the post-reload state without scraping logs.decdn node reloadprints two grep-friendly lines (or--json), matching thedecdn node healthshape.Closes #373.
Test plan
cargo nextest run -p decdn-node— 199/199 passing, including:admin_reload_without_hook_returns_config_path_unsetadmin_reload_applies_and_returns_post_reload_valuesadmin_reload_with_missing_config_returns_reload_errorcli_reload_surfaces_connection_refusedcli_reload_rejects_zero_timeoutcargo clippy -p decdn-node --all-targets -- -D warningsclean.cargo fmt --checkclean.decdn node reload --helprenders.🤖 Generated with Claude Code