batch appends - #5
Conversation
|
@mvayngrib thanks for all the PRs. I'll go through them all over the weekend :) |
|
@mafintosh great, thanks |
| key: item.key, | ||
| value: item.value | ||
| } | ||
| }), function(err) { |
There was a problem hiding this comment.
if the feed fails do we reset the change count?
There was a problem hiding this comment.
but if one batch fails and meanwhile the next succeeds? Resetting might make things even weirder. I guess this is where mutefixy kept things simple
There was a problem hiding this comment.
yea this gets a bit tricky fast. maybe we should add some tests (somehow) for this so we can make we hit all the edge-cases
There was a problem hiding this comment.
i think the simplest solution is:
- set a flag that we are running a batch.
- if flag is set append to a known tmp batch
- after 1 completes unset flag and if tmp batch is not empty goto 1 and run that batch
basically a mutex batch (should be super fast)
There was a problem hiding this comment.
right, the tmp batch we already have, it's feed.batch. We just need a lock around the commit so there is never the possibility of commit 2 succeeding while commit1 fails.
the question is what to do when the current batch fails, and there's also a tmp batch in the balance
|
@mvayngrib btw, do you want to help maintain this module? i can add you as collaborator if you want :) |
|
@mafintosh yes, add me please :) |
|
@mvayngrib added. whats your npm username? |
|
@mafintosh npm username: tenaciousmv (also, see line note above re: batch locks) |
based on #4