This commit is contained in:
Acid Chicken (硫酸鶏) 2018-12-25 20:02:37 +09:00
parent 97f7043178
commit c9cd81cc62
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { performance } from 'perf_hooks'; import { performance } from 'perf_hooks';
import limitter from './limitter'; import limiter from './limiter';
import { IUser } from '../../models/user'; import { IUser } from '../../models/user';
import { IApp } from '../../models/app'; import { IApp } from '../../models/app';
import endpoints from './endpoints'; import endpoints from './endpoints';
@ -39,7 +39,7 @@ export default (endpoint: string, user: IUser, app: IApp, data: any, file?: any)
if (ep.meta.requireCredential && ep.meta.limit) { if (ep.meta.requireCredential && ep.meta.limit) {
try { try {
await limitter(ep, user); // Rate limit await limiter(ep, user); // Rate limit
} catch (e) { } catch (e) {
// drop request if limit exceeded // drop request if limit exceeded
return rej('RATE_LIMIT_EXCEEDED'); return rej('RATE_LIMIT_EXCEEDED');

View File

@ -5,7 +5,7 @@ import { IEndpoint } from './endpoints';
import getAcct from '../../misc/acct/render'; import getAcct from '../../misc/acct/render';
import { IUser } from '../../models/user'; import { IUser } from '../../models/user';
const log = debug('misskey:limitter'); const log = debug('misskey:limiter');
export default (endpoint: IEndpoint, user: IUser) => new Promise((ok, reject) => { export default (endpoint: IEndpoint, user: IUser) => new Promise((ok, reject) => {
// Redisがインストールされてない場合は常に許可 // Redisがインストールされてない場合は常に許可