Ignore Cloudflare timeout

Don't even notify the user of a Cloudflare timeout, just keep running the interval.
This commit is contained in:
Brian Huisman 2024-05-17 10:22:18 -04:00
parent f7fbaadf9b
commit f34f5097fc

View file

@ -744,22 +744,20 @@ os_crawl_start.addEventListener('click', function(e) {
}); });
// Cancel immediately if we get a 500 response // Cancel immediately if we get a 500 response
} else if (response.status >= 500) { // 524 = Cloudflare timeout, the crawler is still running
} else if (response.status >= 500 && response.status != 524) {
clearInterval(os_crawl_interval); clearInterval(os_crawl_interval);
if (response.status != 524) { os_crawl_cancel.reason = 'The crawler unexpectedly halted with HTTP response code ' + response.status + ': ' + response.statusText;
os_crawl_cancel.reason = 'The crawler unexpectedly halted with HTTP response code ' + response.status + ': ' + response.statusText;
alert( alert(
'Error: ' + os_crawl_cancel.reason + "\n" + 'Error: ' + os_crawl_cancel.reason + "\n" +
'The crawl will be cancelled and reset.' 'The crawl will be cancelled and reset.'
); );
console.error('Error: ', error); console.error('Error: ', error);
os_crawl_cancel.force = true; os_crawl_cancel.force = true;
os_crawl_cancel.click(); os_crawl_cancel.click();
} else alert('Cloudflare has timed out your connection to the crawler. The crawler is still running; refresh the page to see ongoing updates.');
} }
}); });