CC-4943: Raspberry Pi optimization: don't create new background AJAX request until the previous one has returned

-fixed
This commit is contained in:
Martin Konecny 2013-02-14 12:58:31 -05:00
parent 30c47df93d
commit bb7e56e39e
7 changed files with 22 additions and 12 deletions

View File

@ -360,13 +360,15 @@ function controlSwitchLight(){
}
function getScheduleFromServer(){
$.ajax({ url: baseUrl+"Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
$.ajax({ url: baseUrl+"Schedule/get-current-playlist/format/json",
dataType:"json",
success:function(data){
parseItems(data.entries);
parseSourceStatus(data.source_status);
parseSwitchStatus(data.switch_status);
showName = data.show_name;
setTimeout(getScheduleFromServer, serverUpdateInterval);
}, error:function(jqXHR, textStatus, errorThrown){}});
setTimeout(getScheduleFromServer, serverUpdateInterval);
}
function setupQtip(){

View File

@ -768,8 +768,7 @@ var AIRTIME = (function(AIRTIME) {
});
checkImportStatus();
setInterval(checkImportStatus, 5000);
setInterval(checkLibrarySCUploadStatus, 5000);
checkLibrarySCUploadStatus();
addQtipToSCIcons();
@ -997,6 +996,7 @@ function checkImportStatus() {
}
div.hide();
}
setTimeout(checkImportStatus, 5000);
});
}
@ -1030,6 +1030,7 @@ function checkLibrarySCUploadStatus(){
else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error");
}
setTimeout(checkLibrarySCUploadStatus, 5000);
}
function checkSCUploadStatusRequest() {

View File

@ -103,6 +103,8 @@ function checkLiquidsoapStatus(){
}
$("#s"+id+"Liquidsoap-error-msg-element").html(html);
}
setTimeout(checkLiquidsoapStatus, 2000);
});
}
@ -242,10 +244,10 @@ function setupEventListeners() {
return false;
})
setLiveSourceConnectionOverrideListener()
setLiveSourceConnectionOverrideListener();
showErrorSections()
setInterval('checkLiquidsoapStatus()', 1000)
showErrorSections();
checkLiquidsoapStatus();
// qtip for help text
$(".override_help_icon").qtip({

View File

@ -372,6 +372,7 @@ function checkSCUploadStatus(){
}else if(json.sc_id == "-3"){
$("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("sc-error");
}
setTimeout(checkSCUploadStatus, 5000);
});
});
}
@ -424,6 +425,7 @@ function getCurrentShow(){
$(this).remove("span[small-icon now-playing]");
}
});
setTimeout(getCurrentShow, 5000);
});
}
@ -564,8 +566,8 @@ function alertShowErrorAndReload(){
preloadEventFeed();
$(document).ready(function(){
setInterval( "checkSCUploadStatus()", 5000 );
setInterval( "getCurrentShow()", 5000 );
checkSCUploadStatus();
getCurrentShow();
});
var view_name;

View File

@ -93,6 +93,8 @@ function checkCalendarSCUploadStatus(){
else if (json.sc_id == "-3") {
span.removeClass("progress").addClass("sc-error");
}
setTimeout(checkCalendarSCUploadStatus, 5000);
}
function checkSCUploadStatusRequest() {
@ -328,7 +330,7 @@ function alertShowErrorAndReload(){
}
$(document).ready(function() {
setInterval(checkCalendarSCUploadStatus, 5000);
checkCalendarSCUploadStatus();
$.contextMenu({
selector: 'div.fc-event',

View File

@ -277,12 +277,13 @@ AIRTIME = (function(AIRTIME) {
if (json.update === true) {
oTable.fnDraw();
}
setTimeout(checkScheduleUpdates, 5000);
}
});
}
//check if the timeline view needs updating.
setInterval(checkScheduleUpdates, 5 * 1000); //need refresh in milliseconds
checkScheduleUpdates();
};
mod.onResize = function() {

View File

@ -66,6 +66,7 @@ function success(data, textStatus, jqXHR){
if (data.status.partitions){
generatePartitions(data.status.partitions);
}
setTimeout(function(){updateStatus(false);}, 5000);
}
function updateStatus(getDiskInfo){
@ -75,5 +76,4 @@ function updateStatus(getDiskInfo){
$(document).ready(function() {
updateStatus(true);
setInterval(function(){updateStatus(false);}, 5000);
});