定时任务:修复自动开服开关
This commit is contained in:
@@ -645,10 +645,15 @@ export async function stopMaintenance(batchCode: string, serverIds: number[]) {
|
||||
// —————————————— 自动开服 —————————————— //
|
||||
export async function initAutoCreateServer(region?: RegionType) {
|
||||
if(!region) region = await RegionModel.findRegionByEnv(pinus.app.get('env'));
|
||||
if(region && region.stategy) {
|
||||
for(let timer of region.stategy.timers) {
|
||||
setStategyTimer(timer, region)
|
||||
}
|
||||
if(region && region.stategy && region.stategy.isOpen) {
|
||||
for(let timer of region.stategy.timers) {
|
||||
setStategyTimer(timer, region)
|
||||
}
|
||||
} else {
|
||||
if(scheduledJobs[`autoServer${SERVER_TIMER.FIVE_HALF}`]) scheduledJobs[`autoServer${SERVER_TIMER.FIVE_HALF}`].cancel();
|
||||
if(scheduledJobs[`autoServer${SERVER_TIMER.TEN_HALF}`]) scheduledJobs[`autoServer${SERVER_TIMER.FIVE_HALF}`].cancel();
|
||||
if(scheduledJobs[`autoServer${SERVER_TIMER.FIFTEEN_HALF}`]) scheduledJobs[`autoServer${SERVER_TIMER.FIVE_HALF}`].cancel();
|
||||
if(scheduledJobs[`autoServer${SERVER_TIMER.NINETEEN_HALF}`]) scheduledJobs[`autoServer${SERVER_TIMER.FIVE_HALF}`].cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user