mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #15409 from overleaf/jpa-history-v1-http-timeout
[history-v1] make http request timeout configurable GitOrigin-RevId: b31b1c94563ddb5195f92af303e6b0f234856795
This commit is contained in:
parent
b7c4f3333e
commit
47820c61a0
8 changed files with 18 additions and 6 deletions
|
@ -43,5 +43,6 @@
|
|||
},
|
||||
"clusterWorkers": "CLUSTER_WORKERS",
|
||||
"maxFileUploadSize": "MAX_FILE_UPLOAD_SIZE",
|
||||
"httpsOnly": "HTTPS_ONLY"
|
||||
"httpsOnly": "HTTPS_ONLY",
|
||||
"httpRequestTimeout": "SHARELATEX_HISTORY_V1_HTTP_REQUEST_TIMEOUT"
|
||||
}
|
||||
|
|
|
@ -261,6 +261,10 @@ const settings = {
|
|||
url: process.env.V1_HISTORY_URL || 'http://localhost:3100/api',
|
||||
user: 'staging',
|
||||
pass: process.env.STAGING_PASSWORD,
|
||||
requestTimeout: parseInt(
|
||||
process.env.SHARELATEX_HISTORY_V1_HTTP_REQUEST_TIMEOUT || '300000', // default is 5min
|
||||
10
|
||||
),
|
||||
},
|
||||
},
|
||||
references: {},
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// Metrics must be initialized before importing anything else
|
||||
require('@overleaf/metrics/initialize')
|
||||
|
||||
const config = require('config')
|
||||
const Events = require('events')
|
||||
const BPromise = require('bluebird')
|
||||
const express = require('express')
|
||||
|
@ -47,9 +48,9 @@ app.use(cors())
|
|||
security.setupSSL(app)
|
||||
security.setupBasicHttpAuthForSwaggerDocs(app)
|
||||
|
||||
const HTTP_REQUEST_TIMEOUT = parseInt(config.get('httpRequestTimeout'), 10)
|
||||
app.use(function (req, res, next) {
|
||||
// use a 5 minute timeout on all responses
|
||||
res.setTimeout(5 * 60 * 1000)
|
||||
res.setTimeout(HTTP_REQUEST_TIMEOUT)
|
||||
next()
|
||||
})
|
||||
|
||||
|
|
|
@ -56,5 +56,6 @@
|
|||
},
|
||||
"clusterWorkers": "CLUSTER_WORKERS",
|
||||
"maxFileUploadSize": "MAX_FILE_UPLOAD_SIZE",
|
||||
"httpsOnly": "HTTPS_ONLY"
|
||||
"httpsOnly": "HTTPS_ONLY",
|
||||
"httpRequestTimeout": "HTTP_REQUEST_TIMEOUT"
|
||||
}
|
||||
|
|
|
@ -25,5 +25,6 @@
|
|||
"maxFileUploadSize": "52428800",
|
||||
"databasePoolMin": "2",
|
||||
"databasePoolMax": "10",
|
||||
"httpsOnly": "false"
|
||||
"httpsOnly": "false",
|
||||
"httpRequestTimeout": "300000"
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import * as Errors from './Errors.js'
|
|||
import * as LocalFileWriter from './LocalFileWriter.js'
|
||||
import * as HashManager from './HashManager.js'
|
||||
|
||||
const HTTP_REQUEST_TIMEOUT = 300 * 1000 // 5 minutes
|
||||
const HTTP_REQUEST_TIMEOUT = Settings.apis.history_v1.requestTimeout
|
||||
|
||||
/**
|
||||
* Container for functions that need to be mocked in tests
|
||||
|
|
|
@ -20,6 +20,9 @@ module.exports = {
|
|||
filestore: {
|
||||
url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
|
||||
},
|
||||
history_v1: {
|
||||
requestTimeout: parseInt(process.env.V1_REQUEST_TIMEOUT || '300000', 10),
|
||||
},
|
||||
web: {
|
||||
url: `http://${
|
||||
process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
|
||||
|
|
|
@ -23,6 +23,7 @@ describe('HistoryStoreManager', function () {
|
|||
filestore: {
|
||||
url: 'http://filestore.sharelatex.production',
|
||||
},
|
||||
history_v1: { requestTimeout: 123 },
|
||||
},
|
||||
}
|
||||
this.latestChunkRequestArgs = sinon.match({
|
||||
|
|
Loading…
Reference in a new issue