From bf34e53d5b666c567f24fec9c813d7d6e8044fb9 Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Tue, 3 Jun 2025 10:39:57 +0300 Subject: [PATCH] Fix for timeout error --- data_providers/avtocod.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/data_providers/avtocod.js b/data_providers/avtocod.js index e580130..d5408ad 100644 --- a/data_providers/avtocod.js +++ b/data_providers/avtocod.js @@ -22,6 +22,10 @@ const sign = { let deviceToken = uuidv4().replaceAll('-', '').toUpperCase(); var cookie = null; +setInterval(() => { + cookie = null; +}, 10*60*60*1000); + const myWs = function (options) { return class wsClass extends WebSocket { constructor(...args) { @@ -140,7 +144,10 @@ function getToken(ctx) { return new Promise((resolve, reject) => { fetch(tokenRefreshUrl, { method: 'POST', - headers: new Headers({ 'Content-Type': 'application/json' }), + headers: new Headers({ + 'Content-Type': 'application/json', + 'cookie': cookie + }), body: JSON.stringify(ctx) }) .then(res => { @@ -184,7 +191,7 @@ function waitForReport(centrifugoConfig, channel) { } else { reject(new Error('Request to avtocod timed out')); } - }, 10000); + }, 15000); const sub = centrifuge.newSubscription(channel);