up to 3 tries to load a page, delaying it 1 second, giving time for other ressources to load, fixed problem that sometimes not all stats are loaded

This commit is contained in:
Ulf Gebhardt 2015-04-11 17:54:28 +02:00
parent bb0090af82
commit 066ad2f158

View File

@ -27,13 +27,22 @@ SYSTEM.prototype.hashchange = function () {
if(system.hash_change){
system.hash_change(system.cur_state().split(';')[0].split('(')[0]);}
};
SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached) {
SYSTEM.prototype.handle_call_pages_page = function (html,entry,id,forced,cached,trycount) {
var url = entry['url']+(window.location.search.substr(1) ? '&'+window.location.search.substr(1) : '' );
if(!trycount){
trycount = 0;}
trycount++;
if($(entry['div']).length){
$(entry['div']).html(html);
this.log_info('load page: '+id+entry['div']+' '+url+' - success');
this.log_info('load page: '+id+entry['div']+' '+url+' - try '+trycount+' - success');
} else {
this.log_error('load page: '+id+entry['div']+' '+url+' - div not found');
this.log_error('load page: '+id+entry['div']+' '+url+' - try '+trycount+' - div not found');
//Try again
if(trycount < 3){
var tc = trycount;
setTimeout(function() { system.handle_call_pages_page(html,entry,id,forced,cached,tc); },1000);
}
return;
}
//load css
for(var i=0; i < entry['css'].length; i++){