瀏覽代碼

fix bug with skin caching that cached capes as non-existent

when using cache.save_hash, an `undefined` skin or cape hash means "do not touch"
while `null` means "overwrite as non-existent"

this was sent to redis after calling /capes/Notch for the first time:

  "hmset" "notch" "c" "3f688e0e699b3d9fe448b5bb50a3a288f9c589762b3dae8308842122dcb81" "t" "1429651244222"
  "hmset" "notch" "s" "a116e69a845e227f7ca1fdde8c357c8c821ebd4ba619382ea4a1f87d4ae94" "c" "" "t" "1429651244235"

as you can see, the first request stores the c(ape) but does not touch the s(kin), whereas the second request
sets the s(kin) and replaces the c(ape) value
jomo 10 年之前
父節點
當前提交
244f90c4c7
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lib/helpers.js

+ 1 - 1
lib/helpers.js

@@ -177,7 +177,7 @@ function store_images(rid, userId, cache_details, type, callback) {
             // an error occured, not caching. we can try in 60 seconds
             // an error occured, not caching. we can try in 60 seconds
             callback_for(userId, "skin", store_err, null);
             callback_for(userId, "skin", store_err, null);
           } else {
           } else {
-            cache.save_hash(rid, userId, skin_hash, null, function(cache_err) {
+            cache.save_hash(rid, userId, skin_hash, undefined, function(cache_err) {
               callback_for(userId, "skin", (store_err || cache_err), skin_hash);
               callback_for(userId, "skin", (store_err || cache_err), skin_hash);
             });
             });
           }
           }