aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Joiner <anacrolix@gmail.com>2020-09-23 11:47:50 +1000
committerMatt Joiner <anacrolix@gmail.com>2020-09-23 11:47:50 +1000
commite0a706da27a7cf612d68fe2469112b1ad2dd7aa0 (patch)
tree2eca0e161ab1814819a416e825c58d6c14f1dfd9
parentCopy circle CI config from anacrolix/dht (diff)
downloadstm-e0a706da27a7cf612d68fe2469112b1ad2dd7aa0.tar.gz
stm-e0a706da27a7cf612d68fe2469112b1ad2dd7aa0.tar.xz
Sleep by default again, and don't bother sleeping for less than 100 microseconds
-rw-r--r--funcs.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/funcs.go b/funcs.go
index 2e2ad26..b7a2c29 100644
--- a/funcs.go
+++ b/funcs.go
@@ -23,7 +23,7 @@ var (
const (
profileFailedCommits = false
- sleepBetweenRetries = false
+ sleepBetweenRetries = true
)
func init() {
@@ -59,8 +59,8 @@ retry:
shift = maxShift
}
ns := int64(1) << shift
- ns = rand.Int63n(ns)
- if ns > 0 {
+ d := time.Duration(rand.Int63n(ns))
+ if d > 100*time.Microsecond {
tx.updateWatchers()
time.Sleep(time.Duration(ns))
}