Move interval stuff to config keys

This commit is contained in:
calzoneman 2013-09-26 23:41:38 -05:00
parent 6bf11a57b3
commit ba66aadf66
3 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -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)

View file

@ -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) {