diff --git a/.github/workflows/daily-curl-request.yml b/.github/workflows/daily-curl-request.yml index 232e13fe..e3491505 100644 --- a/.github/workflows/daily-curl-request.yml +++ b/.github/workflows/daily-curl-request.yml @@ -2,7 +2,7 @@ name: Daily Curl Request on: schedule: - - cron: "*/12 * * * *" + - cron: "*/5 * * * *" jobs: run-curl: @@ -11,4 +11,4 @@ jobs: steps: - name: Run Curl Request # because: https://docs.render.com/free#spinning-down-on-idle - run: curl https://nest-admin-093x.onrender.com/api/auth/captcha/img \ No newline at end of file + run: curl https://nest-admin-093x.onrender.com \ No newline at end of file diff --git a/scripts/resetScheduler.ts b/scripts/resetScheduler.ts index 30213cc6..a9e98b19 100644 --- a/scripts/resetScheduler.ts +++ b/scripts/resetScheduler.ts @@ -5,7 +5,7 @@ import schedule from 'node-schedule' /** 此文件仅供演示时使用 */ const runMigrationGenerate = async function () { - exec('pnpm migration:revert && pnpm migration:run', (error, stdout, stderr) => { + exec('npm run migration:revert && npm run migration:run', (error, stdout, stderr) => { if (!error) console.log('操作成功', error) @@ -13,9 +13,13 @@ const runMigrationGenerate = async function () { console.log('操作失败', error) }) } +runMigrationGenerate() /** 每天凌晨 4.30 恢复初始数据 */ -schedule.scheduleJob('30 4 * * *', () => { +const job = schedule.scheduleJob('30 4 * * *', () => { runMigrationGenerate() console.log('Task executed daily at 4.30 AM:', new Date().toLocaleTimeString()) }) + +// 设置任务的执行时区 +job.setTimezone('Asia/Shanghai')