.remove fails if you restart the server OR insert a new item with .save #6

Open
stagas opened this Issue Aug 11, 2010 · 2 comments

2 participants

@stagas

At first it looks as if the entry is removed, but if I restart the server, or save a new item the removed entry reappears.

@stagas

Might be more than a bug in remove, check this gist http://gist.github.com/520485 , it fails after a save - get - remove - save.

@stuarts

Hmm one problem is that in checkQueue, the key is removed from the index if value.length === 0 but promptly re-added if value !== undefined.


234 updates.forEach(function (value, key) {
235 if (self.index.hasOwnProperty(key)) {
236 self.stale++;
237 if (value.length === 0) {
238 delete self.index[key];
239 }
240 }
241 if (value !== undefined) {
242 self.index[key] = value;
243 }
244 });

Either the deletion should happen after the update or the update should be:

241 if (value !== undefined && value.length !== 0) {
242 self.index[key] = value;
243 }
244 });

Its late here, so I'm not going to fork tonight and submit tonight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment