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
+5 -2
View File
@@ -1,3 +1,4 @@
import cluster from 'node:cluster';
import { pino } from 'pino';
export const log = pino({
@@ -24,7 +25,8 @@ export const env = {
function requireEnv(key: string): string {
const val = Bun.env[key];
if (!val) {
log.error({ name: key }, "Missing required environment variable");
if (cluster.worker?.id === 1)
log.error({ name: key }, "Missing required environment variable");
throw new Error(`Missing required environment variable: ${key}`)
};
return val;
@@ -33,7 +35,8 @@ function requireEnv(key: string): string {
function optionEnv(key: string, fallback: string = ""): string {
const val = Bun.env[key];
if (!val) {
log.warn({ name: key }, `Missing optional environmental variable, falling back to "${fallback}"`)
if (cluster.worker?.id === 1)
log.warn({ name: key }, `Missing optional environmental variable, falling back to "${fallback}"`)
return fallback
};
return val;