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(){ 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); parseItems(data.entries);
parseSourceStatus(data.source_status); parseSourceStatus(data.source_status);
parseSwitchStatus(data.switch_status); parseSwitchStatus(data.switch_status);
showName = data.show_name; showName = data.show_name;
}, error:function(jqXHR, textStatus, errorThrown){}});
setTimeout(getScheduleFromServer, serverUpdateInterval); setTimeout(getScheduleFromServer, serverUpdateInterval);
}, error:function(jqXHR, textStatus, errorThrown){}});
} }
function setupQtip(){ function setupQtip(){

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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