chore: add prettier formatting
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
All checks were successful
CI / Lint, typecheck and build (push) Successful in 9m56s
This commit is contained in:
@@ -13,10 +13,22 @@ loadEnvFile(".env.local", true);
|
||||
|
||||
const appUrl = normalizeAppUrl(process.env.WTR_APP_URL ?? process.env.NEXT_PUBLIC_APP_URL ?? DEFAULT_APP_URL);
|
||||
const cronSecret = process.env.NOTIFICATIONS_CRON_SECRET ?? "";
|
||||
const warningIntervalMinutes = readPositiveNumber(process.env.NOTIFICATIONS_WARNING_INTERVAL_MINUTES, DEFAULT_WARNING_INTERVAL_MINUTES);
|
||||
const briefIntervalMinutes = readPositiveNumber(process.env.NOTIFICATIONS_BRIEF_INTERVAL_MINUTES, DEFAULT_BRIEF_INTERVAL_MINUTES);
|
||||
const morningBriefTime = normalizeTime(process.env.NOTIFICATIONS_MORNING_BRIEF_TIME ?? DEFAULT_MORNING_BRIEF_TIME, DEFAULT_MORNING_BRIEF_TIME);
|
||||
const tomorrowBriefTime = normalizeTime(process.env.NOTIFICATIONS_TOMORROW_BRIEF_TIME ?? DEFAULT_TOMORROW_BRIEF_TIME, DEFAULT_TOMORROW_BRIEF_TIME);
|
||||
const warningIntervalMinutes = readPositiveNumber(
|
||||
process.env.NOTIFICATIONS_WARNING_INTERVAL_MINUTES,
|
||||
DEFAULT_WARNING_INTERVAL_MINUTES,
|
||||
);
|
||||
const briefIntervalMinutes = readPositiveNumber(
|
||||
process.env.NOTIFICATIONS_BRIEF_INTERVAL_MINUTES,
|
||||
DEFAULT_BRIEF_INTERVAL_MINUTES,
|
||||
);
|
||||
const morningBriefTime = normalizeTime(
|
||||
process.env.NOTIFICATIONS_MORNING_BRIEF_TIME ?? DEFAULT_MORNING_BRIEF_TIME,
|
||||
DEFAULT_MORNING_BRIEF_TIME,
|
||||
);
|
||||
const tomorrowBriefTime = normalizeTime(
|
||||
process.env.NOTIFICATIONS_TOMORROW_BRIEF_TIME ?? DEFAULT_TOMORROW_BRIEF_TIME,
|
||||
DEFAULT_TOMORROW_BRIEF_TIME,
|
||||
);
|
||||
|
||||
let lastWarningCheckAt = 0;
|
||||
let lastMorningBriefCheckAt = 0;
|
||||
@@ -112,6 +124,8 @@ async function tick() {
|
||||
}
|
||||
|
||||
console.log(`wtr. notification worker: ${appUrl}`);
|
||||
console.log(`Warnings every ${warningIntervalMinutes} min. Brief checks every ${briefIntervalMinutes} min; targets: ${morningBriefTime} and ${tomorrowBriefTime} in each subscription timezone.`);
|
||||
console.log(
|
||||
`Warnings every ${warningIntervalMinutes} min. Brief checks every ${briefIntervalMinutes} min; targets: ${morningBriefTime} and ${tomorrowBriefTime} in each subscription timezone.`,
|
||||
);
|
||||
void tick();
|
||||
setInterval(tick, LOOP_INTERVAL_MS);
|
||||
|
||||
Reference in New Issue
Block a user