Chg: 新年迎春の投稿する際の遅延を削減 / Feat: 新年迎春を投稿した時刻をコンソールに表示 / Fix: 地震情報のid除外が本番環境で動作しない問題
This commit is contained in:
@@ -44,15 +44,17 @@ if (config.earthquake?.useHistoryData) {
|
||||
return;
|
||||
}
|
||||
|
||||
const id = message.id ?? message._id;
|
||||
const mem = Memory.memory;
|
||||
if (mem.processedInfo.includes(message.id) && !config.debug) {
|
||||
if (mem.processedInfo.includes(id) && !config.debug) {
|
||||
console.log("重複した地震情報: ", message.id);
|
||||
return;
|
||||
}
|
||||
|
||||
processMessage(message);
|
||||
|
||||
if (!config.debug) {
|
||||
mem.processedInfo.concat([message.id]);
|
||||
mem.processedInfo.concat([id]);
|
||||
Memory.memory = mem;
|
||||
}
|
||||
});
|
||||
@@ -76,6 +78,9 @@ const processMessage = async (message: any) => {
|
||||
}
|
||||
|
||||
switch (message.code) {
|
||||
case 555:
|
||||
console.log("ピアの地域分布情報を受信しました");
|
||||
break;
|
||||
case 551:
|
||||
{
|
||||
console.log("地震発生情報を受信しました");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import client from "@/lib/client";
|
||||
import initI18n from "@/lib/i18n";
|
||||
import { format } from "date-fns";
|
||||
import i18next from "i18next";
|
||||
import { parentPort } from "node:worker_threads";
|
||||
|
||||
@@ -18,12 +19,12 @@ parentPort?.on("message", async () => {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log("新年迎春投稿:", response.uniqid);
|
||||
console.log("新年迎春投稿:", `${response.uniqid} (${format(new Date(), "yyyy/M/d H:mm:ss:SSS")})`);
|
||||
process.exit(0);
|
||||
} catch (err: any) {
|
||||
console.error("message" in err
|
||||
? err.message
|
||||
: err);
|
||||
} finally {
|
||||
parentPort?.postMessage("");
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user