|
@@ -36,26 +36,6 @@ function connect_redis() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-// sets the date of the face file belonging to +skin_hash+ to now
|
|
|
-// the helms file is ignored because we only need 1 file to read/write from
|
|
|
-function update_file_date(rid, skin_hash) {
|
|
|
- if (skin_hash) {
|
|
|
- var face_path = path.join(config.directories.faces, skin_hash + ".png");
|
|
|
- fs.exists(face_path, function(exists) {
|
|
|
- if (exists) {
|
|
|
- var date = new Date();
|
|
|
- fs.utimes(face_path, date, date, function(err) {
|
|
|
- if (err) {
|
|
|
- logging.error(rid, "Error:", err.stack);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- logging.error(rid, "tried to update", face_path + " date, but it does not exist");
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
var exp = {};
|
|
|
|
|
|
// returns the redis instance
|
|
@@ -92,11 +72,11 @@ exp.info = function(callback) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-// sets the timestamp for +userId+ and its face file's (+hash+) date to the current time
|
|
|
+// sets the timestamp for +userId+
|
|
|
// if +temp+ is true, the timestamp is set so that the record will be outdated after 60 seconds
|
|
|
// these 60 seconds match the duration of Mojang's rate limit ban
|
|
|
// callback: error
|
|
|
-exp.update_timestamp = function(rid, userId, hash, temp, callback) {
|
|
|
+exp.update_timestamp = function(rid, userId, temp, callback) {
|
|
|
logging.debug(rid, "updating cache timestamp");
|
|
|
var sub = temp ? config.caching.local - 60 : 0;
|
|
|
var time = Date.now() - sub;
|
|
@@ -105,7 +85,6 @@ exp.update_timestamp = function(rid, userId, hash, temp, callback) {
|
|
|
redis.hmset(userId, "t", time, function(err) {
|
|
|
callback(err);
|
|
|
});
|
|
|
- update_file_date(rid, hash);
|
|
|
};
|
|
|
|
|
|
// create the key +userId+, store +skin_hash+, +cape_hash+ and time
|