Continue product sync queue on startup

This commit is contained in:
Dominic Ferrando
2026-07-03 16:37:20 -04:00
parent 4d23052644
commit 69cf4900dd
4 changed files with 73 additions and 48 deletions
+7 -1
View File
@@ -23,6 +23,7 @@ import { env, log } from "./util";
import serverTiming from "@elysia/server-timing";
import jwt from "@elysia/jwt";
import { SyncService } from "./services/sync";
import cluster from "node:cluster";
// SERVICES
// -----------
@@ -248,6 +249,11 @@ export const app = new Elysia()
}
});
app.listen(3000, () => log.info({ port: 3000 }, "server started"));
app.listen(3000, async () => {
log.info({ port: 3000 }, "server started")
if (cluster.worker?.id === 1) {
await syncService.nextSync().catch((err) => log.error({ err }, "failed to resume product sync queue"));
}
});
export type API = typeof app