mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Remove client-side timeouts for the khoj socket
This commit is contained in:
parent
312528d471
commit
a4afada746
1 changed files with 0 additions and 19 deletions
|
@ -48,9 +48,6 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
});
|
||||
}
|
||||
var websocket = null;
|
||||
var timeout = null;
|
||||
var timeoutDuration = 600000; // 10 minutes
|
||||
|
||||
let region = null;
|
||||
let city = null;
|
||||
let countryName = null;
|
||||
|
@ -874,25 +871,12 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
rawResponse: "",
|
||||
}
|
||||
|
||||
function resetTimeout() {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
|
||||
timeout = setTimeout(function() {
|
||||
if (websocket) {
|
||||
websocket.close();
|
||||
}
|
||||
}, timeoutDuration);
|
||||
}
|
||||
|
||||
if (chatBody.dataset.conversationId) {
|
||||
webSocketUrl += `?conversation_id=${chatBody.dataset.conversationId}`;
|
||||
webSocketUrl += (!!region && !!city && !!countryName) ? `®ion=${region}&city=${city}&country=${countryName}` : '';
|
||||
|
||||
websocket = new WebSocket(webSocketUrl);
|
||||
websocket.onmessage = function(event) {
|
||||
resetTimeout();
|
||||
|
||||
// Get the last element in the chat-body
|
||||
let chunk = event.data;
|
||||
|
@ -986,9 +970,6 @@ To get started, just start typing below. You can also type / to see a list of co
|
|||
let statusDotText = document.getElementById("connection-status-text");
|
||||
statusDotText.style.marginTop = "10px";
|
||||
statusDotText.textContent = "Connected to Server";
|
||||
|
||||
// Setup the timeout to close the connection after inactivity.
|
||||
resetTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue