feat: Implement batch processing and scheduling

This commit is contained in:
2025-06-04 17:06:22 +09:00
committed by Satsuki Akiba (aider)
parent 3934d630cb
commit 62fcf4c12c
2 changed files with 153 additions and 12 deletions

View File

@ -166,18 +166,13 @@ app.get("*", async (c) => {
* 初回実行後に1日ごとのバッチ処理をスケジュールする関数
*/
function scheduleFirstBatchProcess() {
console.log("Initial batch process will run in 1 minute...");
setTimeout(async () => {
try {
console.log("Running initial batch process...");
runBatchProcess();
console.log("Initial batch process completed");
} catch (error) {
console.error("Error during initial batch process:", error);
}
// 初回実行後、次回以降の定期実行を設定
scheduleDailyBatchProcess();
}, 60 * 1000); // 1 minute
try {
console.log("Running initial batch process...");
runBatchProcess();
console.log("Initial batch process completed");
} catch (error) {
console.error("Error during initial batch process:", error);
}
}
function scheduleDailyBatchProcess() {
@ -229,5 +224,6 @@ serve(
console.log(`Server is running on http://localhost:${info.port}`);
// 初回実行
scheduleFirstBatchProcess();
scheduleDailyBatchProcess();
},
);