-
Notifications
You must be signed in to change notification settings - Fork 1
fix(enricher): gate the durable refresh so an idle nectar scales Deep Lake to zero #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrisl10
wants to merge
2
commits into
legioncodeinc:main
Choose a base branch
from
chrisl10:fix/enricher-idle-scale-to-zero
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * The enricher working-set refresh signal (scale-to-zero). | ||
| * | ||
| * The steady-state enricher cycle re-seeds its in-memory mirror from Deep Lake | ||
| * (`refreshWorkingSet` -> `DeepLakeEnricherStore.refresh` -> a | ||
| * `SELECT ... FROM hive_graph_versions`) so version rows the registration watcher | ||
| * appended after boot become visible to the enricher's SEPARATE mirror. Doing | ||
| * that unconditionally on every ~30s tick means an idle repo (no file changes, | ||
| * nothing to enrich) still issues a Deep Lake read every 30s forever, which keeps | ||
| * the Activeloop serverless pod warm and defeats its scale-to-zero. That is the | ||
| * same idle-burn class honeycomb removed in PRD-062b; nectar re-introduced it by | ||
| * refreshing on every cycle. | ||
| * | ||
| * This one-bit signal gates the refresh. The registration leg is the ONLY | ||
| * producer of new durable rows this daemon writes, so it `markDirty()`s after | ||
| * each successful durable write; the enricher `consume()`s the flag to decide | ||
| * whether a refresh is worth a network round trip. When no file has changed the | ||
| * flag stays clear, the enricher issues NO Deep Lake read, and the pod idles to | ||
| * zero. The enricher's own describe write-backs go through a different store and | ||
| * never mark this signal, so there is no self-triggering refresh loop. | ||
| */ | ||
|
|
||
| /** A read-and-clear "durable rows may have changed" flag shared by producer and consumer. */ | ||
| export interface RefreshSignal { | ||
| /** Producer (registration): a durable write happened; the next enricher tick should refresh. */ | ||
| markDirty(): void; | ||
| /** Consumer (enricher): read-and-clear. Returns true (and resets to clean) when a refresh is warranted. */ | ||
| consume(): boolean; | ||
| /** Non-destructive read, for tests and observability. Does NOT clear the flag. */ | ||
| readonly dirty: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Create a {@link RefreshSignal}. Defaults to dirty so the FIRST enricher cycle | ||
| * always refreshes once (picking up any rows persisted before this boot, e.g. a | ||
| * prior session that appended `pending` rows but never described them); every | ||
| * subsequent refresh is gated on real registration activity. | ||
| */ | ||
| export function createRefreshSignal(initiallyDirty = true): RefreshSignal { | ||
| let dirty = initiallyDirty; | ||
| return { | ||
| markDirty(): void { | ||
| dirty = true; | ||
| }, | ||
| consume(): boolean { | ||
| const was = dirty; | ||
| dirty = false; | ||
| return was; | ||
| }, | ||
| get dirty(): boolean { | ||
| return dirty; | ||
| }, | ||
| }; | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.