Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit 2e825cc

Browse files
committed
新增 启动间隔阻断
1 parent fcad1e9 commit 2e825cc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/entity/commands/start.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ export default class StartCommand extends InstanceCommand {
6363

6464
// 无限启动检查
6565
const currentTimestamp = new Date().getTime();
66-
const intervals = 3 * 1000;
66+
const intervals = 10 * 1000;
6767
if (instance.startTimestamp && currentTimestamp - instance.startTimestamp < intervals) {
68-
return instance.failure(new Error("两次启动时间间隔太短,本次请求被拒绝,请稍后重试"));
68+
const unbanss = Number((intervals - (currentTimestamp - instance.startTimestamp)) / 1000).toFixed(0);
69+
return instance.failure(new Error(`两次启动间隔太短,本次请求被拒绝,请 ${unbanss} 秒后再试`));
6970
}
7071
// 更新上次启动时间戳
7172
instance.startTimestamp = currentTimestamp;

0 commit comments

Comments
 (0)