Handle "Too many requests"

Added code to handle a different response from the server like 429: Too many requests
This commit is contained in:
foin137
2020-04-25 00:15:03 +02:00
parent e5c89ea33f
commit 056b5b980a

View File

@@ -1788,7 +1788,9 @@ var sekBisTimerBeginn;
function reloadmaintain(game, id){
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
if (xmlhttp.readyState==4)
{
if (xmlhttp.status == 200)
{
if (xmlhttp.responseText == "1")
{
@@ -1799,6 +1801,12 @@ var sekBisTimerBeginn;
setTimeout(reloadmaintain,3500,game,id);
}
}
else
{
//Error
setTimeout(reloadmaintain,2*3500,game,id);
}
}
}
xmlhttp.open("GET","reload.php?game="+ game +"&id="+ id,true);
xmlhttp.send();
@@ -1812,7 +1820,9 @@ var sekBisTimerBeginn;
xmlhttp2.mscaching = "disabled";
xmlhttp2.onreadystatechange=function()
{
if (xmlhttp2.readyState==4 && xmlhttp2.status==200)
if (xmlhttp2.readyState==4)
{
if (xmlhttp2.status==200)
{
var arr = xmlhttp2.responseText.split("$");
if (arr.length > 0)
@@ -1854,6 +1864,12 @@ var sekBisTimerBeginn;
}
setTimeout(listRefresh,3000,game,id, reload);
}
else
{
//Error
setTimeout(listRefresh,2*3000,game,id, reload);
}
}
}
xmlhttp2.send(null);
}
@@ -1862,7 +1878,9 @@ var sekBisTimerBeginn;
{
xmlhttp3.onreadystatechange=function()
{
if (xmlhttp3.readyState==4 && xmlhttp3.status==200)
if (xmlhttp3.readyState==4)
{
if (xmlhttp3.status==200)
{
var text = xmlhttp3.responseText;
var para = document.getElementById("gamelogdiv");
@@ -1883,6 +1901,12 @@ var sekBisTimerBeginn;
setTimeout(gameLogRefresh,8000,game);
}
}
else
{
//Error
setTimeout(gameLogRefresh,2*8000,game);
}
}
}
xmlhttp3.open("GET","gamelogreload.php?game="+ game,true);
xmlhttp3.send();