refactor: change all timestamps to be in seconds

This commit is contained in:
Nicolas Meienberger
2025-11-26 22:41:39 +01:00
parent 4328607cc1
commit 60f37076a8
12 changed files with 776 additions and 34 deletions

View File

@@ -57,7 +57,7 @@ const createVolume = async (name: string, backendConfig: BackendConfig) => {
await db
.update(volumesTable)
.set({ status, lastError: error ?? null, lastHealthCheck: Date.now() })
.set({ status, lastError: error ?? null, lastHealthCheck: Math.floor(Date.now() / 1000) })
.where(eq(volumesTable.name, slug));
return { volume: created, status: 201 };
@@ -91,7 +91,7 @@ const mountVolume = async (name: string) => {
await db
.update(volumesTable)
.set({ status, lastError: error ?? null, lastHealthCheck: Date.now() })
.set({ status, lastError: error ?? null, lastHealthCheck: Math.floor(Date.now() / 1000) })
.where(eq(volumesTable.name, name));
if (status === "mounted") {
@@ -196,7 +196,7 @@ const updateVolume = async (name: string, volumeData: UpdateVolumeBody) => {
const { error, status } = await backend.mount();
await db
.update(volumesTable)
.set({ status, lastError: error ?? null, lastHealthCheck: Date.now() })
.set({ status, lastError: error ?? null, lastHealthCheck: Math.floor(Date.now() / 1000) })
.where(eq(volumesTable.id, existing.id));
serverEvents.emit("volume:updated", { volumeName: updated.name });
@@ -255,7 +255,7 @@ const checkHealth = async (name: string) => {
await db
.update(volumesTable)
.set({ lastHealthCheck: Date.now(), status, lastError: error ?? null })
.set({ lastHealthCheck: Math.floor(Date.now() / 1000), status, lastError: error ?? null })
.where(eq(volumesTable.name, volume.name));
return { status, error };