From 9fbc77e4e998cd9f139d028bfb7e8f24627b96ef Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 13 Jun 2026 15:47:57 +0100 Subject: [PATCH] Drain runtime commits from Economy server --- .voidbot/state/aetheria.cc | Bin 36132 -> 36575 bytes Aetheria.State/README.md | 12 +++++- Economy.Server/Program.cs | 58 +++++++++++++++++++++++++-- docs/aetheria-perfect-machine-map.md | 15 +++++-- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 54ef3c3f498e2126a6eb041beabc8ea7853042e7..0473a60bc25847453b755fe92919f6a2aff6ccd9 100644 GIT binary patch delta 1449 zcmZWpQEOa96tE3 zn^oxA6a-&Hn75)J8Yzf~vM<)R`YH&eAcPkB4+QbaH_zOAH#7+>%f08$ob!F(`OewA zU3>g>?dLnS1M{cmn$i5ioS(aS%>PmQtO~q(k^*(F#y%MZT1DW%{;ArH&Ebjt>5E6) z*;q-H^`lE@*3f`dJ^$c%bI?n_o=;Fhj{P_j$qloWknkTIDv0gLaPgSO#G7Y7mS z0#>9z3%aUMX10_e;4m)N)1Z|Q7CMS(U~kXKk`f`4gm4;|Ou*(^E8{FQ8X+)KQFWt-Ek-_QQP`_g>*^`bs-}aKf8vFHEwyEQd?>tC&)H8 z9TsEs3yZ_CbJ@1=Ti?Em>#jJ6h8S4rDRUics&bJ4u4`pWOo70lWN^YlicGk48U(Yh z5Q&o*F^S@Aso|(032K)Dv*7xgj*QUH5X#CaTv~@L0o4J6q91%h-6Q{5MGS=M+UN%+ z<5ZdDaqQSfPpu3;e);~PeW(04H|objTLVip4b_uWVY~3Q;KQ$)hmO4c=36SxGbDg} zJVfBAL)!3+nf`Wy%A{rEg5{%I-x=&|&G;{)mxhOz{ysQf1n&BW&%EG&Tb@im7_qCE zg-c;{N~1sF(w%egq+1LBB@DAL64DVdCZZp4jhsQ&TQ2y|`^o0)@Qq8i4_;Zh$gIWW zwcV3Nsu2cGc3I6a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-68,6 +92,34 @@ internal static class Program stopped.TrySetResult(null); }; - return stopped.Task; + while (!stopped.Task.IsCompleted) + { + var delay = Task.Delay(pendingInterval); + var completed = await Task.WhenAny(stopped.Task, delay).ConfigureAwait(false); + if (completed == stopped.Task) + break; + + await ApplyPendingRuntimeCommitsAsync(node).ConfigureAwait(false); + } + } + + private static TimeSpan PendingInterval(IReadOnlyList args) + { + for (var i = 0; i < args.Count - 1; i++) + { + if (string.Equals(args[i], "--pending-interval-ms", StringComparison.OrdinalIgnoreCase) && + int.TryParse(args[i + 1], out var milliseconds) && + milliseconds > 0) + { + return TimeSpan.FromMilliseconds(milliseconds); + } + } + + return TimeSpan.FromSeconds(5); + } + + private static bool HasFlag(IReadOnlyList args, string flag) + { + return args.Any(arg => string.Equals(arg, flag, StringComparison.OrdinalIgnoreCase)); } } diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index b8fb123f0..9f467826d 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -41,9 +41,10 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. files, and generated keyboard layout caches no longer write bespoke durable files. The legacy `PlayerSettings` runtime object is no longer decorated as a MessagePack - persistence shape. `Aetheria.State.ApplyPending` is the repo-local applicator - entrypoint for draining `aetheria-world.cc.pending` into canonical typed state - until that worker is hosted as a daemon/CultMesh organ. + persistence shape. `Economy.Server` now drains `aetheria-world.cc.pending` + into canonical typed state on startup and on a daemon polling loop while + hosting the CultMesh state node. `Aetheria.State.ApplyPending` remains a + bounded local operator applicator. - Shared domain state is still partly built around `DatabaseEntry`, GUID identity, MessagePack attributes, and static cache references. Newtonsoft, JsonKnownTypes, RethinkDB, LiteNetLib client transport, and the broken @@ -117,7 +118,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. `ActionGameManager` binds the typed runtime item catalog projected from `aetheria-world.cc`. MessagePack catalog construction no longer grabs global `DatabaseLinkBase` authority. -- `Economy.Server` now starts the modern `Aetheria.State` CultMesh node and no +- `Economy.Server` now starts the modern `Aetheria.State` CultMesh node, drains + pending Unity runtime commits through the typed state applicator, and no longer owns RethinkDB/LiteNetLib state. - `Aetheria.State.Import` writes a typed quarantine manifest and migration ledger for the legacy catalog files. It also raw-decodes stable old @@ -170,6 +172,9 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. successfully applied command files by default. It is an operational bridge, not a second state owner; the applicator delegates all writes to `AetheriaStateNode`. +- `Economy.Server` hosts the CultMesh state node and now owns the long-running + pending runtime commit drain loop. `--apply-pending-once` runs the same drain + path once for smoke/operator use without keeping the process alive. - `AetheriaCatalogSurfaceProjector` now emits the first provider-owned Eve surface from typed catalog state. The importer materializes a `gamecult.eve.surface.v1` catalog operator document at @@ -530,6 +535,8 @@ First Aetheria surfaces to publish: documents. - Done: add `Aetheria.State.ApplyPending` as a bounded local applicator for queued runtime commits until the drain loop is hosted as a daemon. + - Done: move the pending runtime commit drain into `Economy.Server` startup + and daemon polling, with `--apply-pending-once` for bounded operation. - Done: stop legacy catalog pull/read paths from writing entries back to their source backing store. - Done: delete legacy catalog backing-store write/realtime APIs.