Continue product sync queue on startup
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user