Make toobusy.maxLag configurable

Signed-off-by: Toshinori Notake <toshi.notake.43568@gmail.com>
This commit is contained in:
Toshinori Notake 2019-07-18 13:48:40 +09:00
parent d5f60d8c63
commit 4e91268e1f
4 changed files with 7 additions and 0 deletions

View File

@ -56,6 +56,8 @@ module.exports = {
// socket.io // socket.io
heartbeatInterval: 5000, heartbeatInterval: 5000,
heartbeatTimeout: 10000, heartbeatTimeout: 10000,
// toobusy-js
responseMaxLag: 70,
// document // document
documentMaxLength: 100000, documentMaxLength: 100000,
// image upload setting, available options are imgur/s3/filesystem/azure // image upload setting, available options are imgur/s3/filesystem/azure

View File

@ -33,6 +33,7 @@ module.exports = {
dbURL: process.env.CMD_DB_URL, dbURL: process.env.CMD_DB_URL,
sessionSecret: process.env.CMD_SESSION_SECRET, sessionSecret: process.env.CMD_SESSION_SECRET,
sessionLife: toIntegerConfig(process.env.CMD_SESSION_LIFE), sessionLife: toIntegerConfig(process.env.CMD_SESSION_LIFE),
responseMaxLag: toIntegerConfig(process.env.CMD_RESPONSE_MAX_LAG),
imageUploadType: process.env.CMD_IMAGE_UPLOAD_TYPE, imageUploadType: process.env.CMD_IMAGE_UPLOAD_TYPE,
imgur: { imgur: {
clientID: process.env.CMD_IMGUR_CLIENTID clientID: process.env.CMD_IMGUR_CLIENTID

View File

@ -28,6 +28,7 @@ module.exports = {
dbURL: process.env.HMD_DB_URL, dbURL: process.env.HMD_DB_URL,
sessionSecret: process.env.HMD_SESSION_SECRET, sessionSecret: process.env.HMD_SESSION_SECRET,
sessionLife: toIntegerConfig(process.env.HMD_SESSION_LIFE), sessionLife: toIntegerConfig(process.env.HMD_SESSION_LIFE),
responseMaxLag: toIntegerConfig(process.env.HMD_RESPONSE_MAX_LAG),
imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE, imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE,
imgur: { imgur: {
clientID: process.env.HMD_IMGUR_CLIENTID clientID: process.env.HMD_IMGUR_CLIENTID

View File

@ -2,8 +2,11 @@
const toobusy = require('toobusy-js') const toobusy = require('toobusy-js')
const config = require('../../config')
const response = require('../../response') const response = require('../../response')
toobusy.maxLag(config.responseMaxLag);
module.exports = function (req, res, next) { module.exports = function (req, res, next) {
if (toobusy()) { if (toobusy()) {
response.errorServiceUnavailable(res) response.errorServiceUnavailable(res)