fix: host imports running a defaults pass and metrics restart per host (#1384)

This commit is contained in:
LukeGus committed 2026-10-03 15:37:07 -05:00
1 parent 5e31642379
commit 11a22d30eb
6 files changed
+76 -10

No files matched your search

+19
View File
@@ -25,3 +25,22 @@ export async function applyDefaultsAfterHostWrite(
});
}
}
/**
* The same for many hosts written in one go (an import), in a single pass
* instead of one per host.
*/
export async function applyDefaultsAfterHostWrites(
hostIds: number[],
): Promise<void> {
if (hostIds.length === 0) return;
try {
await recompute({ hostIds });
} catch (error) {
databaseLogger.warn("Could not apply host defaults after a write", {
operation: "host_defaults_after_write",
hosts: hostIds.length,
error: error instanceof Error ? error.message : String(error),
});
}
}