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

@@ -105,7 +105,7 @@ const createRepository = async (name: string, config: RepositoryConfig, compress
if (!error) {
await db
.update(repositoriesTable)
.set({ status: "healthy", lastChecked: Date.now(), lastError: null })
.set({ status: "healthy", lastChecked: Math.floor(Date.now() / 1000), lastError: null })
.where(eq(repositoriesTable.id, id));
return { repository: created, status: 201 };
@@ -258,7 +258,7 @@ const checkHealth = async (repositoryId: string) => {
.update(repositoriesTable)
.set({
status,
lastChecked: Date.now(),
lastChecked: Math.floor(Date.now() / 1000),
lastError: error,
})
.where(eq(repositoriesTable.id, repository.id));
@@ -335,7 +335,7 @@ const doctorRepository = async (name: string) => {
.update(repositoriesTable)
.set({
status: allSuccessful ? "healthy" : "error",
lastChecked: Date.now(),
lastChecked: Math.floor(Date.now() / 1000),
lastError: allSuccessful ? null : steps.find((s) => !s.success)?.error,
})
.where(eq(repositoriesTable.id, repository.id));