socket-function 0.50.0 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/callManager.ts +6 -0
package/package.json
CHANGED
package/src/callManager.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { _setSocketContext } from "../SocketFunction";
|
|
|
4
4
|
import { entries, isNode } from "./misc";
|
|
5
5
|
import debugbreak from "debugbreak";
|
|
6
6
|
import { measureWrap } from "./profiling/measure";
|
|
7
|
+
import { formatTime } from "./formatting/format";
|
|
7
8
|
|
|
8
9
|
let classes: {
|
|
9
10
|
[classGuid: string]: {
|
|
@@ -144,7 +145,12 @@ export const runClientHooks = measureWrap(async function runClientHooks(
|
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
for (let hook of clientHooks) {
|
|
148
|
+
let time = Date.now();
|
|
147
149
|
await hook(context);
|
|
150
|
+
time = Date.now() - time;
|
|
151
|
+
if (time > 100) {
|
|
152
|
+
console.warn(`Slow (${formatTime(time)}) client hook: ${JSON.stringify(hook.name || hook.toString().slice(0, 100))} for ${callType.classGuid}.${callType.functionName}(...)`);
|
|
153
|
+
}
|
|
148
154
|
// NOTE: See ClientHookContext.overrideResult for why we break here
|
|
149
155
|
if ("overrideResult" in context) {
|
|
150
156
|
break;
|