Merge pull request #14562 from overleaf/jpa-disable-connection-checking

[web] workaround for broken detection of idle connections in CI

GitOrigin-RevId: ae9ff2b9b1bf99b56d8eb1af6e035b6ed08f7477
This commit is contained in:
Jakob Ackermann 2023-08-29 17:37:10 +02:00 committed by Copybot
parent 625714a924
commit 6b61d906ba
3 changed files with 28 additions and 3 deletions

View file

@ -303,7 +303,15 @@ if (Settings.csp && Settings.csp.enabled) {
}
logger.debug('creating HTTP server'.yellow)
const server = require('http').createServer(app)
const server = require('http').createServer(
process.env.NODE_ENV === 'test'
? {
// Workaround broken detection of idle connections in CI.
connectionsCheckingInterval: 30 * 60 * 1000,
}
: {},
app
)
// provide settings for separate web and api processes
if (Settings.enabledServices.includes('api')) {

View file

@ -9,6 +9,7 @@ const express = require('express')
const {
plainTextResponse,
} = require('../../../app/src/infrastructure/Response')
const http = require('http')
const LinkedUrlProxy = express()
LinkedUrlProxy.get('/', (req, res, next) => {
if (req.query.url === 'http://example.com/foo') {
@ -29,7 +30,15 @@ describe('LinkedFiles', function () {
let server
before(function (done) {
server = LinkedUrlProxy.listen(6543, done)
server = http
.createServer(
{
// Workaround broken detection of idle connections in CI.
connectionsCheckingInterval: 30 * 60 * 1000,
},
LinkedUrlProxy
)
.listen(6543, done)
})
after(function (done) {
server.close(done)

View file

@ -1,6 +1,7 @@
const OError = require('@overleaf/o-error')
const express = require('express')
const bodyParser = require('body-parser')
const http = require('http')
/**
* Abstract class for running a mock API via Express. Handles setting up of
@ -139,7 +140,14 @@ class AbstractMockApi {
// eslint-disable-next-line no-console
console.log('Starting mock on port', this.constructor.name, this.port)
}
this.server = this.app
this.server = http
.createServer(
{
// Workaround broken detection of idle connections in CI.
connectionsCheckingInterval: 30 * 60 * 1000,
},
this.app
)
.listen(this.port, err => {
if (err) {
return reject(err)