Chg: 全てのスケジュールが正確に動作するように

This commit is contained in:
2026-05-16 19:20:16 +09:00
parent 33435f4c46
commit 3a446440d3
8 changed files with 73 additions and 35 deletions
+8
View File
@@ -2,6 +2,7 @@ import client from "@/lib/client";
import config from "@/lib/config";
import initI18n from "@/lib/i18n";
import Memory from "@/lib/memory";
import CronExpressionParser from "cron-parser";
import i18next from "i18next";
import { readFileSync } from "node:fs";
import { EOL } from "node:os";
@@ -63,6 +64,13 @@ if (
workerData.startsWith("scheduledWeatherNotice")
) {
await initI18n();
const cronStr = workerData.endsWith("Tomorrow")
? "0 18 * * *"
: "0 7 * * *"
const next = BigInt(CronExpressionParser.parse(cronStr).next().getTime() * 1_000_000);
while (process.hrtime.bigint() > next) {}
console.log("天気予報の投稿を行います");
try {