diff --git a/changelog b/changelog index e4aa04d6..eb9c9ab6 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +Thu Sep 26 23:40 2013 CDT + * lib/config.js: Add config keys for statistics interval & max age, + alias purge interval & max age. + * lib/bgtask.js: Update intervals to reflect new config keys + Thu Sep 26 23:33 2013 CDT * lib/stats.js: Remove this file, move the statistics tracking interval to the new bgtask.js diff --git a/lib/bgtask.js b/lib/bgtask.js index 821c73cc..9b2b9a1b 100644 --- a/lib/bgtask.js +++ b/lib/bgtask.js @@ -23,8 +23,8 @@ var init = null; /* Stats */ function initStats(Server) { - const STAT_INTERVAL = 60 * 60 * 1000; - const STAT_EXPIRE = 24 * STAT_INTERVAL; + var STAT_INTERVAL = Server.cfg["stat-interval"]; + var STAT_EXPIRE = Server.cfg["stat-max-age"]; setInterval(function () { var db = Server.db; @@ -44,11 +44,10 @@ function initStats(Server) { /* Alias cleanup */ function initAliasCleanup(Server) { - const CLEAN_INTERVAL = 60 * 60 * 1000; - const CLEAN_EXPIRE = 30 * 24 * 60 * 60 * 1000; // 1 month + var CLEAN_INTERVAL = Server.cfg["alias-purge-interval"]; + var CLEAN_EXPIRE = Server.cfg["alias-max-age"]; setInterval(function () { - console.log("cleaning aliases"); Server.db.cleanOldAliases(CLEAN_EXPIRE, function (err) { Logger.syslog.log("Cleaned old aliases"); if (err) diff --git a/lib/config.js b/lib/config.js index 92a4b78f..aa29d9ec 100644 --- a/lib/config.js +++ b/lib/config.js @@ -44,7 +44,11 @@ var defaults = { "domain" : "http://localhost", "ytv3apikey" : "", "enable-ytv3" : false, - "ytv2devkey" : "" + "ytv2devkey" : "", + "stat-interval" : 3600000, + "stat-max-age" : 86400000, + "alias-purge-interval": 3600000, + "alias-max-age" : 2592000000 } function save(cfg, file) {