perf: 同步ID: 更新优先级

main
Lei OT 8 months ago
parent 209ff98f36
commit 7f474378aa

@ -48,12 +48,16 @@ const AidsState = () => {
console.log('--------------------syncing heytrip, get available accommodation ids.--------------------');
const isRunning = jobAS.pendingInvocations[0]?.job?.running == 1;
if (!isRunning) {
try {
const res = await heytripService.syncAidState();
// jobAS.cancel(); // debug: 0
if (res.nextPage !== true) {
console.log('job completed! canceled job[AidsState]!');
jobAS.cancel();
}
} catch (error) {
}
} else {
console.log('pre job running! cancelNext[AidsState]');
jobAS.cancelNext();

@ -212,7 +212,7 @@ class Heytrip {
// 已存在ID: 更新: 状态, 页码, 时间
const stateNormal = savedIds.filter((item) => validIds.includes((item.hotel_id))).map((item) => item.hotel_id);
if (!isEmpty(stateNormal)) {
await HeytripIds.update({ update_flag: 0, priority: 0, page_index: pageIndex, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: stateNormal } ,logging: false, });
await HeytripIds.update({ update_flag: 0, priority: Sequelize.literal('priority+5'), page_index: pageIndex, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: stateNormal } ,logging: false, });
}
// 新增ID
const newIds = validIds.filter((id) => !savedIds.map((item) => item.hotel_id).includes(id));
@ -264,7 +264,7 @@ class Heytrip {
WHERE h.hi2_sn IS NULL
AND update_flag != 99
-- AND update_flag = 0
ORDER BY info_exists,priority LIMIT 10`
ORDER BY priority LIMIT 10`
, { logging: false }
);
const res = await this.syncInitHotelLgcDetailsAction(rows, LGC_MAPPED[lgc]);

Loading…
Cancel
Save