Skip to content

Commit 650c0db

Browse files
author
NAKAJIMA Susumu
committed
Fix: cache reading error
1 parent 7058be3 commit 650c0db

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

proxy.js

+17-21
Original file line numberDiff line numberDiff line change
@@ -229,26 +229,22 @@ function saveCache(path, callback) {
229229
}
230230
}
231231

232-
function loadCache(opts, callback) {
233-
if(!("cache" in opts)) {
234-
return callback(null);
235-
} else {
236-
readJSON(opts["filter.cache"], function(cache, err) {
237-
if(!!err) {
238-
if(err["code"] == 'ENOENT') return callback(null);
239-
console.log(err);
240-
return process.abort();
241-
} else {
242-
ids = cache || [];
243-
244-
ids = ids.filter(function(id) {
245-
return opts["exclude.id"].indexOf(id) == -1;
246-
});
247-
248-
return callback(cache);
249-
}
250-
});
251-
}
232+
function loadCache(path, callback) {
233+
readJSON(opts["filter.cache"], function(cache, err) {
234+
if(!!err) {
235+
console.log(err);
236+
if(err["code"] == 'ENOENT') return callback(null);
237+
return process.abort();
238+
} else {
239+
ids = cache || [];
240+
241+
ids = ids.filter(function(id) {
242+
return opts["exclude.id"].indexOf(id) == -1;
243+
});
244+
245+
return callback(cache);
246+
}
247+
});
252248
}
253249

254250
function loadOpts(callback) {
@@ -278,7 +274,7 @@ function loadOpts(callback) {
278274
opts["filter.post_type"].push("angelSight");
279275
}
280276

281-
loadCache(opts, function(){callback(opts);});
277+
loadCache(opts["filter.cache"], function(){callback(opts);});
282278
});
283279

284280
}

0 commit comments

Comments
 (0)