Skip to content
Snippets Groups Projects
Commit 5f68d08c authored by syuilo's avatar syuilo
Browse files

Improve log

parent 773d1043
No related branches found
No related tags found
No related merge requests found
......@@ -46,12 +46,14 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
// API invoking
try {
const a = performance.now();
const before = performance.now();
res = await exec(data, user, app);
const b = performance.now();
const after = performance.now();
if (b - a > 500) {
console.warn(`SLOW API CALL DETECTED: ${ep.name}`);
const time = after - before;
if (time > 500) {
console.warn(`SLOW API CALL DETECTED: ${ep.name} (${ time }ms)`);
}
} catch (e) {
rej(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment