app/assets/javascripts/qujo/qujo.js in qujo-0.1.1 vs app/assets/javascripts/qujo/qujo.js in qujo-0.1.2
- old
+ new
@@ -1,5 +1,7 @@
+var intervalTime = 2000;
+var timeoutTime = 600000;
var interval = null;
$(function () {
var queuestatus = $("#qujo_status").first();
var jobstatus = $("#jobs_status").first();
var resqstatus = $("#resque_status").first();
@@ -13,10 +15,13 @@
queuestatus.removeClass("label-important");
}
function qError(){
queuestatus.addClass("label-important");
}
+ function qWarn(){
+ queuestatus.addClass("label-warning");
+ }
function jFine(){
jobstatus.removeClass("badge-important");
}
function jError(){
jobstatus.addClass("badge-important");
@@ -57,11 +62,12 @@
if (d["resque"]["error"]) {
qError();
rError();
}
}).fail(function (d) {
- console.log("status: fail: "+d);
+ console.log("status: fail: ");
+ console.log(d);
qStop();
qError();
jError();
rError();
jText('!');
@@ -70,10 +76,15 @@
clearInterval(interval);
});
}
if (jobstatus.size()) {
- interval = setInterval(updateStatus, 2000);
+ interval = setInterval(updateStatus, intervalTime);
+ timeout = setTimeout(function(){
+ console.log("disable interval");
+ qWarn();
+ clearInterval(interval);
+ }, timeoutTime); // disable interval after 10 minutes of inactivity
}
$(".create_job").on("click", function () {
var c = $(this).attr("klass");
console.log("create job");