Skip to content

Commit

Permalink
concurrency: fix STM example to add to balance
Browse files Browse the repository at this point in the history
Worked by coincidence; the txn would always retry and there
was a 1/10 chance it would pass by selecting the same to/from keys.
  • Loading branch information
Anthony Romano committed Aug 23, 2017
1 parent 8a8f5e3 commit b962863
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clientv3/concurrency/example_stm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func ExampleSTM_apply() {

// transfer amount
xfer := fromInt / 2
fromInt, toInt = fromInt-xfer, toInt-xfer
fromInt, toInt = fromInt-xfer, toInt+xfer

// writeback
stm.Put(fromK, fmt.Sprintf("%d", fromInt))
Expand Down

0 comments on commit b962863

Please sign in to comment.