robtweed/ewd-redis-globals

Possible problem if key has no children but has own data

Opened this issue · 0 comments

if (redis.countZMembers.call(this, childrenKey) === 0) {
//console.log('no more children left for ' + childrenKey);
// no children left, so delete the node and recurse up a level
nodeKey = nodeRoot + this.key_separator + flatSubs;
//console.log('delete ' + nodeKey);
redis.deleteKey.call(this, nodeKey);

db.createNode('rob', ['a'], 'hello');
db.createNode('rob', ['a', 'b'], 'world');

db.deleteNode('rob', ['a', 'b']);

by using the same logic for ewd-memory-globals project I got the following
screenshot 2018-06-14 21 51 03

it seems it deletes node:rob:a but it shouldn't.

@robtweed WDYT?