egg_server/schedule/index.ts
zhaoyingbo f27af143e1
All checks were successful
Egg CI/CD / build-image (push) Successful in 41s
Egg CI/CD / deploy (push) Successful in 1m14s
feat: 更新定时发送排名信息的频率为每天晚上七点
2024-06-17 13:10:01 +00:00

13 lines
429 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);
// 每天的每天晚上七点发送一次消息
schedule.scheduleJob("0 19 * * *", sendRank);
// 立即执行一次
resetAccessToken();
};