mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 01:13:48 +01:00
This commit is contained in:
parent
b0e0016cec
commit
ebc406a76c
@ -1,3 +1,4 @@
|
|||||||
|
import { performance } from 'perf_hooks';
|
||||||
import limitter from './limitter';
|
import limitter from './limitter';
|
||||||
import { IUser } from '../../models/user';
|
import { IUser } from '../../models/user';
|
||||||
import { IApp } from '../../models/app';
|
import { IApp } from '../../models/app';
|
||||||
@ -45,7 +46,13 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
|
|||||||
|
|
||||||
// API invoking
|
// API invoking
|
||||||
try {
|
try {
|
||||||
|
const a = performance.now();
|
||||||
res = await exec(data, user, app);
|
res = await exec(data, user, app);
|
||||||
|
const b = performance.now();
|
||||||
|
|
||||||
|
if (b - a > 500) {
|
||||||
|
console.warn(`SLOW API CALL DETECTED: ${ep.name}`);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
rej(e);
|
rej(e);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user