From 6961b1bdd26877614c5aeab4b7b33083b4da80b3 Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Wed, 18 Jan 2023 09:53:04 +0800 Subject: [PATCH] Fix: Use default timeout & CachebleDnsHttpsAgent --- server/model/monitor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index e5e911af9..28fae9e64 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -495,13 +495,17 @@ class Monitor extends BeanModel { const options = { url: `/containers/${this.docker_container}/json`, + timeout: this.interval * 1000 * 0.8, headers: { "Accept": "*/*", "User-Agent": "Uptime-Kuma/" + version, }, - httpsAgent: new https.Agent({ + httpsAgent: CacheableDnsHttpAgent.getHttpsAgent({ maxCachedSessions: 0, // Use Custom agent to disable session reuse (https://github.com/nodejs/node/issues/3940) - rejectUnauthorized: ! this.getIgnoreTls(), + rejectUnauthorized: !this.getIgnoreTls(), + }), + httpAgent: CacheableDnsHttpAgent.getHttpAgent({ + maxCachedSessions: 0, }), };