egg_server/schedule/index.ts
zhaoyingbo 4fd11f3569
All checks were successful
Egg CI/CD / build-image (push) Successful in 45s
Egg CI/CD / deploy (push) Successful in 1m10s
feat: 更新定时发送排名信息的频率为每1小时
2024-06-17 09:23:49 +00:00

13 lines
447 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { resetAccessToken } from "./accessToken";
import schedule from "node-schedule";
import sendRank from "./rank";
export const initSchedule = async () => {
// 定时任务每15分钟刷新一次token
schedule.scheduleJob("*/15 * * * *", resetAccessToken);
// 每天的早九到晚九点每1小时发送一次排行榜
schedule.scheduleJob("0 9-21 * * *", sendRank);
// 立即执行一次
resetAccessToken();
};