summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortunkki <tunkki@tunkkikone>2016-08-14 17:47:01 +0300
committertunkki <tunkki@tunkkikone>2016-08-14 17:47:01 +0300
commit33f3d9b7a8183949a06adffcd8f11485bc6f5cce (patch)
tree55508980e027458ca2f437a117be22f48784f472
parentd84a59f489b7994630a1c4c94befcc7d63f08f6c (diff)
Change update interval to 60 seconds
-rw-r--r--index.js14
-rw-r--r--public/client.js4
2 files changed, 11 insertions, 7 deletions
diff --git a/index.js b/index.js
index f2f9210..b57e2bc 100644
--- a/index.js
+++ b/index.js
@@ -13,6 +13,9 @@ if (args.length != 2) {
process.exit(1);
}
+var UPDATE_INTERVAL = 60000;
+var PORT = 3000;
+
var username = args[0];
var password = args[1];
@@ -30,19 +33,17 @@ app.get("/status", function(req, res) {
res.json(currentStatus);
});
-app.listen(3000, function() {
- console.log("radiodiodi status display listening on port 3000.");
+app.listen(PORT, function() {
+ console.log("radiodiodi status display listening on port " + PORT + ".");
});
-
function get_status(err, data) {
currentStatus = [];
for (var i = 0; i < data.length; i++) {
- var is_up = data[i].Status == 'Up';
var system = {}
system.name = data[i].WebsiteName;
- system.status = is_up;
+ system.status = data[i].Status == 'Up';
system.uptime = data[i].Uptime;
currentStatus.push(system);
}
@@ -50,6 +51,7 @@ function get_status(err, data) {
console.log(currentStatus);
}
+statuscake.tests(get_status);
setInterval(function() {
statuscake.tests(get_status);
-}, 5000);
+}, UPDATE_INTERVAL);
diff --git a/public/client.js b/public/client.js
index 4b946f5..6461502 100644
--- a/public/client.js
+++ b/public/client.js
@@ -1,5 +1,7 @@
var statusapp = angular.module('status-app', []);
+var UPDATE_INTERVAL = 60000;
+
statusapp.controller('status-controller', ['$scope', '$http', function status_controller($scope, $http) {
$scope.systems = [];
@@ -14,6 +16,6 @@ statusapp.controller('status-controller', ['$scope', '$http', function status_co
});
};
- setInterval(update, 5000);
+ setInterval(update, UPDATE_INTERVAL);
update();
}]);