[Server] Enable slow option

This commit is contained in:
syuilo 2019-02-04 10:03:49 +09:00
parent d6dba7fd71
commit c4c7783691
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
2 changed files with 8 additions and 4 deletions

View File

@ -6,6 +6,7 @@ program
.option('--no-daemons', 'Disable daemon processes (for debbuging)') .option('--no-daemons', 'Disable daemon processes (for debbuging)')
.option('--disable-clustering', 'Disable clustering') .option('--disable-clustering', 'Disable clustering')
.option('--quiet', 'Suppress all logs') .option('--quiet', 'Suppress all logs')
.option('--slow', 'Delay all requests (for debbuging)')
.parse(process.argv); .parse(process.argv);
export { program }; export { program };

View File

@ -13,7 +13,7 @@ import * as mount from 'koa-mount';
import * as compress from 'koa-compress'; import * as compress from 'koa-compress';
import * as koaLogger from 'koa-logger'; import * as koaLogger from 'koa-logger';
import * as requestStats from 'request-stats'; import * as requestStats from 'request-stats';
//import * as slow from 'koa-slow'; import * as slow from 'koa-slow';
import activityPub from './activitypub'; import activityPub from './activitypub';
import webFinger from './webfinger'; import webFinger from './webfinger';
@ -23,6 +23,7 @@ import apiServer from './api';
import { sum } from '../prelude/array'; import { sum } from '../prelude/array';
import User from '../models/user'; import User from '../models/user';
import Logger from '../misc/logger'; import Logger from '../misc/logger';
import { program } from '../argv';
export const serverLogger = new Logger('server', 'gray'); export const serverLogger = new Logger('server', 'gray');
@ -37,9 +38,11 @@ if (!['production', 'test'].includes(process.env.NODE_ENV)) {
})); }));
// Delay // Delay
//app.use(slow({ if (program.slow) {
// delay: 1000 app.use(slow({
//})); delay: 3000
}));
}
} }
// Compress response // Compress response