mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 16:03:10 +02:00
Clean up
This commit is contained in:
parent
278e43e9ba
commit
110eeb89f1
1 changed files with 0 additions and 9 deletions
|
@ -1,4 +1,3 @@
|
||||||
import { performance } from 'perf_hooks';
|
|
||||||
import limiter from './limiter';
|
import limiter from './limiter';
|
||||||
import { IUser } from '../../models/user';
|
import { IUser } from '../../models/user';
|
||||||
import { IApp } from '../../models/app';
|
import { IApp } from '../../models/app';
|
||||||
|
@ -50,15 +49,7 @@ export default async (endpoint: string, user: IUser, app: IApp, data: any, file?
|
||||||
|
|
||||||
// API invoking
|
// API invoking
|
||||||
try {
|
try {
|
||||||
const before = performance.now();
|
|
||||||
res = await ep.exec(data, user, app, file);
|
res = await ep.exec(data, user, app, file);
|
||||||
const after = performance.now();
|
|
||||||
|
|
||||||
const time = after - before;
|
|
||||||
|
|
||||||
if (time > 1000) {
|
|
||||||
console.warn(`SLOW API CALL DETECTED: ${ep.name} (${time}ms)`);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e && e.name == 'INVALID_PARAM') {
|
if (e && e.name == 'INVALID_PARAM') {
|
||||||
throw {
|
throw {
|
||||||
|
|
Loading…
Reference in a new issue