Serialize Heimdall Odin catalog publication

This commit is contained in:
Meta Vens 2026-08-22 03:40:55 +02:00
commit 1ba75b729a
2 changed files with 12 additions and 3 deletions

View file

@ -35,9 +35,9 @@ export async function publishHeimdallOdinState(
options.environment ?? process.env,
);
const publish = options.publish ?? publishRecord;
await Promise.all(
buildHeimdallVerseRecords(config, pulse).map((record) => publish(record, endpoint)),
);
for (const record of buildHeimdallVerseRecords(config, pulse)) {
await publish(record, endpoint);
}
}
async function publishRecord(
@ -60,6 +60,8 @@ async function publishRecord(
record.key,
payload,
{
flushTimeoutMs: 500,
resendPollMs: 10,
sourceRole: "heimdall-auth-authority",
tags: ["heimdall", "redacted", "discovery"],
},

View file

@ -16,16 +16,22 @@ describe("Heimdall Odin publication", () => {
});
const pulse = createHeimdallRuntimePulse(config, "2026-08-22T12:00:00.000Z");
const published: CultCacheRecord[] = [];
let inFlight = 0;
let maximumInFlight = 0;
await publishHeimdallOdinState(config, pulse, {
environment: { CULTMESH_URI_ODIN_RUDP: "10.77.0.1:17871" },
publish: async (record, endpoint) => {
inFlight += 1;
maximumInFlight = Math.max(maximumInFlight, inFlight);
expect(endpoint).toEqual({
host: "10.77.0.1",
port: 17871,
uri: "rudp://10.77.0.1:17871",
});
published.push(record);
await Promise.resolve();
inFlight -= 1;
},
});
@ -40,6 +46,7 @@ describe("Heimdall Odin publication", () => {
expect(serialized).not.toContain("must-never-publish-either");
expect(serialized).not.toContain("access_token");
expect(serialized).not.toContain("refresh_token");
expect(maximumInFlight).toBe(1);
});
it("does not invent an Odin route when publication is not configured", async () => {