From 0ade2b285500dcebbf9995f3d101d20c50e22639 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Tue, 25 Feb 2020 23:32:12 +0800 Subject: [PATCH] feat: exclude async event monitor Signed-off-by: MiaoWoo --- packages/api/src/event.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/api/src/event.ts b/packages/api/src/event.ts index ed7c4105..9a018da6 100644 --- a/packages/api/src/event.ts +++ b/packages/api/src/event.ts @@ -98,9 +98,11 @@ export namespace event { if (eventCls.isAssignableFrom(event.getClass())) { let time = Date.now() exec(event); - let cost = Date.now() - time; - if (cost > 20) { - console.console(`§c注意! §6插件 §b${name} §6处理 §d${this.class2Name(eventCls)} §6事件 §c耗时 §4${cost}ms !`) + if (event.isAsynchronous()) { + let cost = Date.now() - time; + if (cost > 20) { + console.console(`§c注意! §6插件 §b${name} §6处理 §d${this.class2Name(eventCls)} §6事件 §c耗时 §4${cost}ms !`) + } } } } catch (ex) {