Browse Source

定时任务

release_0.0.2
巴林闲侠 3 years ago
parent
commit
bfdf962443
  1. 2
      code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js
  2. 2
      code/VideoAccess-VCMP/api/app/lib/schedule/index.js

2
code/VideoAccess-VCMP/api/app/lib/schedule/freshYingshiMsg.js

@ -102,6 +102,7 @@ module.exports = function (app, opts) {
}, },
async () => { async () => {
try { try {
const startTime = moment()
const { models } = app.fs.dc const { models } = app.fs.dc
const { token4yingshi, getYingshiPlayUrl } = app.fs.utils const { token4yingshi, getYingshiPlayUrl } = app.fs.utils
const secretRes = await models.SecretYingshi.findAll() const secretRes = await models.SecretYingshi.findAll()
@ -137,6 +138,7 @@ module.exports = function (app, opts) {
} }
} }
} }
console.info(`萤石设备 ${deviceList.length} 播放地址更新查询用时 ${moment().diff(startTime, 'seconds')} s`)
} catch (error) { } catch (error) {
app.fs.logger.error(`sechedule: freshYingshiPlayUrl, error: ${error}`); app.fs.logger.error(`sechedule: freshYingshiPlayUrl, error: ${error}`);
} }

2
code/VideoAccess-VCMP/api/app/lib/schedule/index.js

@ -10,7 +10,7 @@ module.exports = async function (app, opts) {
interval, immediate interval, immediate
}, callback) => { }, callback) => {
const j = nodeSchedule.scheduleJob(interval, callback); const j = nodeSchedule.scheduleJob(interval, callback);
if (immediate && opts.dev) { if (immediate && !opts.dev) {
setTimeout(callback, 0) setTimeout(callback, 0)
} }
return j; return j;

Loading…
Cancel
Save