feat: sse for volume status change

This commit is contained in:
Nicolas Meienberger
2025-11-08 11:07:09 +01:00
parent fd3a527164
commit 11dd6f46c8
6 changed files with 23 additions and 6 deletions

View File

@@ -224,6 +224,10 @@ const checkHealth = async (name: string) => {
const backend = createVolumeBackend(volume);
const { error, status } = await backend.checkHealth();
if (status !== volume.status) {
serverEvents.emit("volume:status_changed", { volumeName: name, status });
}
await db
.update(volumesTable)
.set({ lastHealthCheck: Date.now(), status, lastError: error ?? null })