Skip to content

Commit

Permalink
uniform round naming for consensus strategies
Browse files Browse the repository at this point in the history
  • Loading branch information
lukwallace committed Nov 3, 2021
1 parent ea043d3 commit 642dd0d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export default function mandatoryTimerStrategy(consensusGroup, strategyOptions)
defaultActions: [],
maxRounds: Infinity,
name: (list)=> {
return `round-${list.length + 1}`;
const NUMBER_SIZE = 3;
const number = `${list.length + 1}`.padStart(NUMBER_SIZE, '0');
return `round-${number}`;
}
}, strategyOptions);
return consensusGroup.list().then((consensusList)=> {
Expand All @@ -24,7 +26,7 @@ export default function mandatoryTimerStrategy(consensusGroup, strategyOptions)
const newConsensusPromise = consensusGroup.consensus(name).create({
roles: options.roles,
executeActionsImmediately: false
});
});
return newConsensusPromise;
});
}

0 comments on commit 642dd0d

Please sign in to comment.