mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
concurrency: fix STM example to add to balance
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.
This commit is contained in:
parent
1d195521c7
commit
b206afc4a7
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user