egg_server/schedule/index.ts
zhaoyingbo fe3b08bae4
All checks were successful
Egg CI/CD / build-image (push) Successful in 54s
Egg CI/CD / deploy (push) Successful in 36s
feat: 更新定时发送排名信息的频率为每20分钟
2024-06-17 02:39:11 +00:00

14 lines
466 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);
// 每天的早九到晚九点每20分钟发送一次排行榜
schedule.scheduleJob("*/20 9-21 * * *", sendRank);
// 立即执行一次
resetAccessToken();
sendRank();
};