aboutsummaryrefslogtreecommitdiff
path: root/retry.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-22 12:31:30 -0300
committerEuAndreh <eu@euandre.org>2025-01-22 12:31:30 -0300
commit59d879ef4e654ce53c2450e000ffa435f06c2f0e (patch)
tree05ae996bf799b1e51f891a5586b3b72fa9bdfe3f /retry.go
parentSetup Makefile build skeleton (diff)
downloadstm-59d879ef4e654ce53c2450e000ffa435f06c2f0e.tar.gz
stm-59d879ef4e654ce53c2450e000ffa435f06c2f0e.tar.xz
Unify code into default repo format
Diffstat (limited to 'retry.go')
-rw-r--r--retry.go24
1 files changed, 0 insertions, 24 deletions
diff --git a/retry.go b/retry.go
deleted file mode 100644
index 1adcfd0..0000000
--- a/retry.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package stm
-
-import (
- "runtime/pprof"
-)
-
-var retries = pprof.NewProfile("stmRetries")
-
-// retry is a sentinel value. When thrown via panic, it indicates that a
-// transaction should be retried.
-var retry = &struct{}{}
-
-// catchRetry returns true if fn calls tx.Retry.
-func catchRetry[R any](fn Operation[R], tx *Tx) (result R, gotRetry bool) {
- defer func() {
- if r := recover(); r == retry {
- gotRetry = true
- } else if r != nil {
- panic(r)
- }
- }()
- result = fn(tx)
- return
-}