use seconds in config, don't clear .files

This commit is contained in:
jomo 2014-11-30 02:55:29 +01:00
parent d65dbd83a2
commit cf43f1dc07
6 changed files with 8 additions and 5 deletions

View File

@ -32,8 +32,11 @@ exp.run = function() {
var helmdir = __dirname + "/../" + config.helms_dir; var helmdir = __dirname + "/../" + config.helms_dir;
var files = fs.readdirSync(skindir); var files = fs.readdirSync(skindir);
for (var i = 0; i < Math.min(files.length, config.cleaning_amount); i++) { for (var i = 0; i < Math.min(files.length, config.cleaning_amount); i++) {
fs.unlink(skindir + files[i], function(){}); var filename = files[i];
fs.unlink(helmdir + files[i], function(){}); if (filename[0] != ".") {
fs.unlink(skindir + filename, function(){});
fs.unlink(helmdir + filename, function(){});
}
} }
} else { } else {
logging.log("ImageCleaner: Nothing to clean"); logging.log("ImageCleaner: Nothing to clean");

View File

@ -4,7 +4,7 @@ var config = {
default_size: 160, // size to be used when no size given default_size: 160, // size to be used when no size given
local_cache_time: 3600, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response local_cache_time: 3600, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response
browser_cache_time: 3600, // seconds until browser will request image again browser_cache_time: 3600, // seconds until browser will request image again
cleaning_interval: 1800000, // ms interval: deleting images if disk size at limit cleaning_interval: 1800, // seconds interval: deleting images if disk size at limit
cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning
cleaning_amount: 50000, // amount of avatar (and their helm) files to clean cleaning_amount: 50000, // amount of avatar (and their helm) files to clean
http_timeout: 1000, // ms until connection to mojang is dropped http_timeout: 1000, // ms until connection to mojang is dropped

View File

@ -5,7 +5,7 @@ var config = {
local_cache_time: 30, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response local_cache_time: 30, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response
browser_cache_time: 30, // seconds until browser will request image again browser_cache_time: 30, // seconds until browser will request image again
http_timeout: 3000, // ms until connection to mojang is dropped http_timeout: 3000, // ms until connection to mojang is dropped
cleaning_interval: 3000, // ms interval: deleting images if disk size at limit cleaning_interval: 3, // seconds interval: deleting images if disk size at limit
cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning
cleaning_amount: 50000, // amount of avatar (and their helm) files to clean cleaning_amount: 50000, // amount of avatar (and their helm) files to clean
faces_dir: "skins/faces/", // directory where faces are kept. should have trailing "/" faces_dir: "skins/faces/", // directory where faces are kept. should have trailing "/"

View File

@ -11,4 +11,4 @@ var server = app.listen(app.get("port"), function() {
}); });
// cleaning worker // cleaning worker
setInterval(clean.run, config.cleaning_interval); setInterval(clean.run, config.cleaning_interval * 1000);

0
skins/faces/.gitkeep Normal file
View File

0
skins/helms/.gitkeep Normal file
View File