feat(engine): add PersistenceGate and expose on RpcHandle#23590
Closed
decofe wants to merge 5 commits into
Closed
Conversation
Adds a persistence gate to PersistenceHandle so external callers can suppress new persistence cycles during latency-critical windows (e.g. block proposal on fast-block-time chains). PersistenceHandle::set_persistence_enabled(false) causes should_persist() to return false, preventing new SaveBlocks from being dispatched. In-flight persistence is unaffected. Defaults to true. Co-Authored-By: joshieDo <93316087+joshieDo@users.noreply.github.com> Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d961d-12d6-73da-9a80-f732efbbd314
3a6a81b to
8f18164
Compare
joshieDo
reviewed
Apr 16, 2026
Co-Authored-By: joshieDo <93316087+joshieDo@users.noreply.github.com> Co-Authored-By: Georgios Konstantopoulos <17802178+gakonst@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d961d-12d6-73da-9a80-f732efbbd314
Introduces PersistenceGate, a shared gate that controls whether the engine tree handler starts new persistence cycles. Exposed on RpcHandle so external consumers (e.g. Tempo) can pause/resume persistence via set_persistence_enabled()/is_persistence_enabled(). Also refactors build_engine_orchestrator to accept a PersistenceHandle directly instead of spawning it internally, removing three parameters and simplifying the return type. Amp-Thread-ID: https://ampcode.com/threads/T-019d96a7-4bee-7528-8c27-75b8d57f247d Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d96a7-4bee-7528-8c27-75b8d57f247d Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019d96a7-4bee-7528-8c27-75b8d57f247d Co-authored-by: Amp <amp@ampcode.com>
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.
Adds
PersistenceGate, a shared gate that suppresses new persistence cycles during latency-critical windows (e.g. block proposal on fast-block-time chains).RpcHandle.persistence_gate.set_enabled(false)causesshould_persist()to returnfalse, preventing newSaveBlocksfrom being dispatched. In-flight persistence is unaffected. Defaults totrue.Also refactors
build_engine_orchestratorto accept aPersistenceHandledirectly instead of spawning it internally.