bookkeeper-tutorial icon indicating copy to clipboard operation
bookkeeper-tutorial copied to clipboard

Race condition

Open Johnlon opened this issue 9 years ago • 2 comments

If Dice.playdice() drops into the follow branch before the takeLeadership callback occurs then the program hangs without generating any dice rolls.

This is because the first block of code in follow() has a loop condition that never breaks out. ie "while (ledgers == null) "

A potential solution is to change the condition to so that one the leadership "while (ledgers == null && !leader)"

Or is this additional check wrong for some reason?

Johnlon avatar Oct 16 '16 01:10 Johnlon

See pull request

Johnlon avatar Oct 16 '16 02:10 Johnlon

@Johnlon for some reason github didn't send me a notification for this. I'm updating the tutorial for the new api, so will add this fix as I go.

ivankelly avatar Nov 28 '17 15:11 ivankelly