Skip to content

Commit 4fe0888

Browse files
committed
chore(scheduler): Use global export for improved clarity
1 parent 249705e commit 4fe0888

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
node_modules/
3+
vuetorrent/
34
.env

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import cors from 'cors'
33
import { config } from 'dotenv'
44
import express, { Router } from 'express'
55
import morgan from 'morgan'
6-
import { scheduleJob } from 'node-schedule'
6+
import scheduler from 'node-schedule'
77
import authMiddleware from './middlewares/auth.js'
88
import configRouter from './routers/config/index.js'
99
import qbitRouter from './routers/qbit/index.js'
@@ -56,7 +56,7 @@ const server = app.listen(PORT, async () => {
5656

5757
const update_cron = process.env.UPDATE_VT_CRON
5858
if (update_cron && update_cron.length) {
59-
scheduleJob(
59+
scheduler.scheduleJob(
6060
'Update VueTorrent',
6161
update_cron,
6262
async () => {
@@ -69,6 +69,7 @@ const server = app.listen(PORT, async () => {
6969
async function stopServer(signal) {
7070
console.log(`Received ${ signal } signal. Gracefully shutting down...`)
7171
server.close()
72+
await scheduler.gracefulShutdown()
7273
}
7374

7475
process.on('SIGTERM', stopServer)

0 commit comments

Comments
 (0)