Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Feb 17, 2024
1 parent 5097228 commit f863713
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/daily-curl-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Daily Curl Request

on:
schedule:
- cron: "*/12 * * * *"
- cron: "*/5 * * * *"

jobs:
run-curl:
Expand All @@ -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
run: curl https://nest-admin-093x.onrender.com
8 changes: 6 additions & 2 deletions scripts/resetScheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,21 @@ 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)

else
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')

0 comments on commit f863713

Please sign in to comment.