Skip to content

Commit

Permalink
fixed last applied check
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Oct 29, 2014
1 parent 7a5afc8 commit dfb0eba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/leader.js
Expand Up @@ -112,10 +112,10 @@ L.replicate = function replicate(logIndex, options, cb) {
function onReplicationSuccess(peerId, peerLogIndex, lastApplied) {
if (!done[peerId] && peerLogIndex >= logIndex) {
done[peerId] = true;
lastApplieds[peerId] = lastApplied;
yep ++;
maybeStop();
}
lastApplieds[peerId] = lastApplied;
maybeStop();
}

function maybeStop() {
Expand Down
9 changes: 2 additions & 7 deletions lib/node.js
Expand Up @@ -484,11 +484,7 @@ N.command = function command(cmd, options, cb, isTopologyChange) {
options = undefined;
}

if (!options) {
options = {
timeout: this.options.commandTimeout
};
}
options = extend({}, {timeout: this.options.commandTimeout}, options);

async.series([
ensureLoaded,
Expand Down Expand Up @@ -535,8 +531,7 @@ N.command = function command(cmd, options, cb, isTopologyChange) {
}

function replicateAgain(cb) {
commitIndex = self.commonState.persisted.log.length();
options.waitForNodeLastApplied = options.commitIndex;
options.waitForNodeLastApplied = commitIndex;
self.state.replicate(commitIndex, options, cb);
}
};
Expand Down

0 comments on commit dfb0eba

Please sign in to comment.