Browse Source

fix(nocodb): handle NONE in appendToList

pull/5430/head
Wing-Kam Wong 2 years ago
parent
commit
d2cfe2e366
  1. 6
      packages/nocodb/src/lib/cache/RedisCacheMgr.ts
  2. 6
      packages/nocodb/src/lib/cache/RedisMockCacheMgr.ts

6
packages/nocodb/src/lib/cache/RedisCacheMgr.ts vendored

@ -247,7 +247,11 @@ export default class RedisCacheMgr extends CacheMgr {
? `${this.prefix}:${scope}:list`
: `${this.prefix}:${scope}:${subListKeys.join(':')}:list`;
log(`RedisCacheMgr::appendToList: append key ${key} to ${listKey}`);
const list = (await this.get(listKey, CacheGetType.TYPE_ARRAY)) || [];
let list = (await this.get(listKey, CacheGetType.TYPE_ARRAY)) || [];
if (list.length === 1 && list[0] === 'NONE') {
list = [];
await this.del(listKey);
}
list.push(key);
return this.set(listKey, list);
}

6
packages/nocodb/src/lib/cache/RedisMockCacheMgr.ts vendored

@ -247,7 +247,11 @@ export default class RedisMockCacheMgr extends CacheMgr {
? `${this.prefix}:${scope}:list`
: `${this.prefix}:${scope}:${subListKeys.join(':')}:list`;
log(`RedisMockCacheMgr::appendToList: append key ${key} to ${listKey}`);
const list = (await this.get(listKey, CacheGetType.TYPE_ARRAY)) || [];
let list = (await this.get(listKey, CacheGetType.TYPE_ARRAY)) || [];
if (list.length === 1 && list[0] === 'NONE') {
list = [];
await this.del(listKey);
}
list.push(key);
return this.set(listKey, list);
}

Loading…
Cancel
Save