Fix mistake in config access for workaroundCloudflare504TimeoutErrors

This commit is contained in:
Eric Eastwood 2023-05-11 16:31:13 -05:00
parent e96f36a1a6
commit b4cc30196e
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ const basePath = config.get('basePath');
assert(basePath); assert(basePath);
const requestTimeoutMs = config.get('requestTimeoutMs'); const requestTimeoutMs = config.get('requestTimeoutMs');
assert(requestTimeoutMs); assert(requestTimeoutMs);
const workaroundCloudflare504TimeoutErrors = config.get('workaroundCloudflare504TimeoutErrors');
// Based off of the `connect-timeout` middleware, // Based off of the `connect-timeout` middleware,
// https://github.com/expressjs/timeout/blob/f2f520f335f2f2ae255d4778e908e8d38e3a4e68/index.js // https://github.com/expressjs/timeout/blob/f2f520f335f2f2ae255d4778e908e8d38e3a4e68/index.js
@ -111,7 +112,7 @@ async function timeoutMiddleware(req, res, next) {
// //
// We want to show our own timeout page because it has more information about what // We want to show our own timeout page because it has more information about what
// went wrong (e.g. which external Matrix API requests were slow). // went wrong (e.g. which external Matrix API requests were slow).
res.status(config.workaroundCloudflare504TimeoutErrors ? 500 : 504); res.status(workaroundCloudflare504TimeoutErrors ? 500 : 504);
res.set('Content-Type', 'text/html'); res.set('Content-Type', 'text/html');