move sleep process (fix #5)

This commit is contained in:
Zichao Lin 2023-10-22 13:36:45 +08:00
parent 1119581d19
commit 88d4474728
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -44,6 +44,11 @@ const nodemailer = require("nodemailer");
var successNum = 0, var successNum = 0,
totalNum = 0; totalNum = 0;
for (key in configs) { for (key in configs) {
var delay = Math.round(
Math.random() * (maxDelay - minDelay) + minDelay
);
log.info(`暂停:${delay}毫秒`);
await sleep(delay);
totalNum++; totalNum++;
log.info(`${key} - 正在执行配置 ${key}`); log.info(`${key} - 正在执行配置 ${key}`);
log.info(`${key} - 尝试签到……`); log.info(`${key} - 尝试签到……`);
@ -98,11 +103,6 @@ const nodemailer = require("nodemailer");
); );
} }
} }
var delay = Math.round(
Math.random() * (maxDelay - minDelay) + minDelay
);
log.info(`暂停:${delay}毫秒`);
await sleep(delay);
} }
if (globalConfig.sendMail == true) { if (globalConfig.sendMail == true) {