rule out double-callbacks when clearing cache

This commit is contained in:
ansuz 2020-12-11 17:06:37 +05:30
parent b307b98926
commit e9033d8b0a

View file

@ -4,7 +4,8 @@ define([
'/common/outer/cache-store.js',
'/bower_components/localforage/dist/localforage.min.js',
'/customize/application_config.js',
], function (Constants, Hash, Cache, localForage, AppConfig) {
'/common/common-util.js',
], function (Constants, Hash, Cache, localForage, AppConfig, Util) {
var LocalStore = {};
LocalStore.setThumbnail = function (key, value, cb) {
@ -120,10 +121,10 @@ define([
return void AppConfig.customizeLogout(cb);
}
cb = cb || function () {};
cb = Util.once(cb || function () {});
try {
Cache.clear(cb); // XXX might call back twice in extreme circumstances?
Cache.clear(cb);
} catch (e) {
console.error(e);
cb();