From 0309f1c298d09b85218dcc54a35064e2dfc29135 Mon Sep 17 00:00:00 2001 From: HGlab <54232526+HGlab01@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:22:07 +0200 Subject: [PATCH] improve axios keep_a_live --- main.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index 151cd460..6541c6ec 100644 --- a/main.js +++ b/main.js @@ -22,7 +22,11 @@ const isOnline = require('@esm2cjs/is-online').default; const https = require('https'); const axios = require('axios'); // @ts-ignore -let axiosInstance = axios.create({}); +let axiosInstance = axios.create({ + timeout: 20000, + baseURL: `${tado_url}/`, + httpsAgent: new https.Agent({ keepAlive: true }), +}); const oneHour = 60 * 60 * 1000; let polling; // Polling timer @@ -1161,9 +1165,7 @@ class Tado extends utils.Adapter { this.refreshToken().then(() => { axiosInstance({ - timeout: 20000, - httpsAgent: new https.Agent({ keepAlive: true }), - url: tado_url + url, + url: url, method: method, data: data, headers: {