Update servermanager.ts

This commit is contained in:
Pax1601 2025-07-29 19:15:59 +02:00 committed by GitHub
parent 8ef86e75f0
commit e7845dd356
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,7 +164,8 @@ export class ServerManager {
xmlHttp.onreadystatechange = (res) => {
if (xmlHttp.readyState == 4 && xmlHttp.status === 0) {
console.error("An error occurred during the XMLHttpRequest");
this.setConnected(false);
if (this.#failedRequestEpoch === null) this.#failedRequestEpoch = Date.now();
else if (Date.now() - this.#failedRequestEpoch > 10000) this.setConnected(false);
errorCallback && errorCallback(xmlHttp.status);
}
};