Skip to content

feat: hot-reload provision releases instead of restarting - #8

Merged
3metaJun merged 1 commit into
metaproxy/v1.0.0-rc.21from
feat/hot-provision-apply
Sep 3, 2026
Merged

feat: hot-reload provision releases instead of restarting#8
3metaJun merged 1 commit into
metaproxy/v1.0.0-rc.21from
feat/hot-provision-apply

Conversation

@3metaJun

@3metaJun 3metaJun commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Every provision release (price, model or channel change) currently ends in a process restart with nginx returning 503 on /v1 and /api for the duration, because ApplyMetaproxyProvision freezes the periodic syncs and reports restart_required.

This change makes the apply reload the in-process state itself after the transaction commits, still holding the provision runtime write lock: loadOptionsFromDatabase() first, then InitChannelCache(), so a model is never routable before its ratio exists. Periodic syncs run under the read lock and cannot interleave with a reload. Idempotent retries of the active digest skip the reload. The freeze flag, IsMetaproxyProvisionRuntimeFrozen and restart_required are removed.

Verification: gofmt, go build ./..., go vet, go test ./model/ ./controller/ -count=1 all pass; new tests cover reload ordering, idempotent-retry skip, in-memory digest activation and routability of the new channel without a restart.

Implemented by GLM-5.3 (opencode) from a spec, reviewed line by line by Claude Fable 5.1 (Claude Code).

馃 Generated with Claude Code

ApplyMetaproxyProvision used to freeze the periodic option and channel syncs after committing and hand a RestartRequired flag back to the host, which then put nginx into maintenance mode and restarted the process. Every price, model or channel change was a user-visible 503 window.

The transaction now reloads the in-process state itself, still under the provision runtime write lock: options and ratios first, then the channel cache, so a model is never routable before its ratio exists. Periodic syncs take the read lock, so they cannot interleave with a reload. An idempotent retry of the already-active digest skips the reload.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@3metaJun
3metaJun merged commit 8cbaa36 into metaproxy/v1.0.0-rc.21 Sep 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant