fix(api): refresh node build versions from heartbeat [CI]
ci/woodpecker/push/web-build Pipeline was successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/push/dev-image Pipeline was successful

This commit is contained in:
justme committed 2026-10-12 01:57:50 +08:00
1 parent fe049c97fa
commit 52059b04c1
2 files changed
+28

No files matched your search

@@ -118,6 +118,7 @@ public sealed class MoShiroNodeEventSink : INodeEventSink
await ApplyHelloAsync(id, hello, ct);
break;
case NodeEventKind.Heartbeat when nodeEvent.Extra is { } extra:
await _nodes.SetVersionAsync(id.Value, NodeKinds.Agent, nodeEvent.Node.NodeVersion, ct);
try
{
AgentRuntimeState state = _runtime.Get(id);
@@ -172,6 +173,8 @@ public sealed class MoShiroNodeEventSink : INodeEventSink
}
}
await _nodes.SetVersionAsync(id.Value, NodeKinds.Probe, nodeEvent.Node.NodeVersion, ct);
await _releases.OfferToNodeAsync(id, ct);
await _schedule.SendToNodeAsync(id, ct);
break;
@@ -182,6 +185,7 @@ public sealed class MoShiroNodeEventSink : INodeEventSink
_quicRuntime.MarkProbeOffline(id.Value, nodeEvent.AtMs);
break;
case NodeEventKind.Heartbeat when nodeEvent.Extra is { } extra:
await _nodes.SetVersionAsync(id.Value, NodeKinds.Probe, nodeEvent.Node.NodeVersion, ct);
try
{
ProbeHeartbeatExtra? heartbeat = extra.Deserialize(MoShiroJsonContext.Default.ProbeHeartbeatExtra);
@@ -254,6 +258,11 @@ public sealed class MoShiroNodeEventSink : INodeEventSink
}
_owners.Report(id.Value, meta.Owners);
if (meta.Platform is { } platform)
{
platform.Version = hello.NodeVersion;
}
await _nodes.SetVersionAsync(id.Value, NodeKinds.Agent, hello.NodeVersion, ct);
AgentRecord? before = await _agents.GetAsync(id, ct);
string? limitsJson = meta.LocalLimits is null ? null : JsonSerializer.Serialize(meta.LocalLimits, LocalLimitsJson.Default.LocalLimits);
string? ipv6Json = meta.Ipv6 is null ? null : JsonSerializer.Serialize(meta.Ipv6, MoShiroJsonContext.Default.Ipv6Diagnostic);