Skip to content
Snippets Groups Projects
Unverified Commit 0a2d8ca1 authored by Rodrigo Nascimento's avatar Rodrigo Nascimento Committed by GitHub
Browse files

Set default timeout of 20s for HTTP calls (#18549)

parent 0e2309ef
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ Package.onUse(function(api) {
'ecmascript',
'mongo',
'email',
'http',
]);
api.mainModule('server/index.js', 'server');
......
......@@ -3,6 +3,18 @@ import { PassThrough } from 'stream';
import { EmailTest } from 'meteor/email';
import { Mongo } from 'meteor/mongo';
import { HTTP } from 'meteor/http';
// Set default HTTP call timeout to 20s
const envTimeout = parseInt(process.env.HTTP_DEFAULT_TIMEOUT, 10);
const timeout = !isNaN(envTimeout) ? envTimeout : 20000;
const { call } = HTTP;
HTTP.call = function _call(method, url, options = {}, callback) {
const defaultTimeout = 'timeout' in options ? options : { ...options, timeout };
return call.call(HTTP, method, url, defaultTimeout, callback);
};
// FIX For TLS error see more here https://github.com/RocketChat/Rocket.Chat/issues/9316
// TODO: Remove after NodeJS fix it, more information
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment