conf: 调整 Jobs

main
Lei OT 10 months ago
parent 5996d9a246
commit 0b2ef0c888

@ -44,6 +44,7 @@ const Aids = () => {
*/ */
const AidsState = () => { const AidsState = () => {
const dailyJob = scheduleJob('0 0 0 * * *', async function () { const dailyJob = scheduleJob('0 0 0 * * *', async function () {
// const dailyJob = scheduleJob('0 20 9 * * *', async function () {
const jobAS = scheduleJob('*/2 * * * * *', async function () { const jobAS = scheduleJob('*/2 * * * * *', async function () {
console.log('--------------------syncing heytrip, get available accommodation ids.--------------------'); console.log('--------------------syncing heytrip, get available accommodation ids.--------------------');
const isRunning = jobAS.pendingInvocations[0]?.job?.running == 1; const isRunning = jobAS.pendingInvocations[0]?.job?.running == 1;
@ -64,14 +65,15 @@ const AidsState = () => {
/** /**
* 获取新增的酒店详情 * 获取新增的酒店详情
* ID同步结束后启动, ID大约需要3小时 * ID同步结束后启动, ID每10W 条大约需要半小时
* 每天03:05:00启动 * 每天03:05:00启动
*/ */
const newHotelDetails = () => { const newHotelDetails = () => {
// return false; // return false;
const dailyJob1 = scheduleJob('0 5 3 * * *', async function () { const dailyJob1 = scheduleJob('0 5 3 * * *', async function () {
// const dailyJob1 = scheduleJob('0 5 12 * * *', async function () {
const job1 = scheduleJob('*/5 * * * * *', async function () { const job1 = scheduleJob('*/5 * * * * *', async function () {
console.log('-------------------------syncing heytrip, get accommodation details.-------------------------'); console.log('-------------------------syncing heytrip[newHotelDetails], get accommodation details.-------------------------');
const isRunning = job1.pendingInvocations[0]?.job?.running == 1; const isRunning = job1.pendingInvocations[0]?.job?.running == 1;
if (!isRunning) { if (!isRunning) {
@ -99,7 +101,7 @@ const hotelLgcDetails = () => {
// return false; // return false;
const dailyJob2 = scheduleJob('0 5 20 * * 5', async function () { const dailyJob2 = scheduleJob('0 5 20 * * 5', async function () {
const job2 = scheduleJob('*/5 * * * * *', async function () { const job2 = scheduleJob('*/5 * * * * *', async function () {
console.log('-------------------------syncing heytrip, get accommodation details.-------------------------'); console.log('-------------------------syncing heytrip[hotelLgcDetails], get accommodation details.-------------------------');
const isRunning = job2.pendingInvocations[0]?.job?.running == 1; const isRunning = job2.pendingInvocations[0]?.job?.running == 1;
if (!isRunning) { if (!isRunning) {
@ -127,7 +129,7 @@ const chinaHotelDetails = () => {
// return false; // return false;
const dailyJobCN = scheduleJob('0 5 20 * * 6', async function () { const dailyJobCN = scheduleJob('0 5 20 * * 6', async function () {
const job3 = scheduleJob('*/4 * * * * *', async function () { const job3 = scheduleJob('*/4 * * * * *', async function () {
console.log('-------------------------syncing heytrip, get china accommodation details.-------------------------'); console.log('-------------------------syncing heytrip[chinaHotelDetails], get china accommodation details.-------------------------');
const isRunning = job3.pendingInvocations[0]?.job?.running == 1; const isRunning = job3.pendingInvocations[0]?.job?.running == 1;
if (!isRunning) { if (!isRunning) {
const res = await heytripService.chinaHotelsLgc2('2'); const res = await heytripService.chinaHotelsLgc2('2');
@ -138,7 +140,7 @@ const chinaHotelDetails = () => {
// job3.reschedule('0 0 0 * * *'); // job3.reschedule('0 0 0 * * *');
} }
} else { } else {
console.log('pre job running! cancelNext'); console.log('pre job running! cancelNext[chinaHotelDetails]');
job3.cancelNext(); job3.cancelNext();
} }
}); });

Loading…
Cancel
Save