Skip to content

Commit 4e91268

Browse files
committed
Make toobusy.maxLag configurable
Signed-off-by: Toshinori Notake <toshi.notake.43568@gmail.com>
1 parent d5f60d8 commit 4e91268

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

lib/config/default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ module.exports = {
5656
// socket.io
5757
heartbeatInterval: 5000,
5858
heartbeatTimeout: 10000,
59+
// toobusy-js
60+
responseMaxLag: 70,
5961
// document
6062
documentMaxLength: 100000,
6163
// image upload setting, available options are imgur/s3/filesystem/azure

lib/config/environment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module.exports = {
3333
dbURL: process.env.CMD_DB_URL,
3434
sessionSecret: process.env.CMD_SESSION_SECRET,
3535
sessionLife: toIntegerConfig(process.env.CMD_SESSION_LIFE),
36+
responseMaxLag: toIntegerConfig(process.env.CMD_RESPONSE_MAX_LAG),
3637
imageUploadType: process.env.CMD_IMAGE_UPLOAD_TYPE,
3738
imgur: {
3839
clientID: process.env.CMD_IMGUR_CLIENTID

lib/config/hackmdEnvironment.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ module.exports = {
2828
dbURL: process.env.HMD_DB_URL,
2929
sessionSecret: process.env.HMD_SESSION_SECRET,
3030
sessionLife: toIntegerConfig(process.env.HMD_SESSION_LIFE),
31+
responseMaxLag: toIntegerConfig(process.env.HMD_RESPONSE_MAX_LAG),
3132
imageUploadType: process.env.HMD_IMAGE_UPLOAD_TYPE,
3233
imgur: {
3334
clientID: process.env.HMD_IMGUR_CLIENTID

lib/web/middleware/tooBusy.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
const toobusy = require('toobusy-js')
44

5+
const config = require('../../config')
56
const response = require('../../response')
67

8+
toobusy.maxLag(config.responseMaxLag);
9+
710
module.exports = function (req, res, next) {
811
if (toobusy()) {
912
response.errorServiceUnavailable(res)

0 commit comments

Comments
 (0)