-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db: add AtomicContext #4724
db: add AtomicContext #4724
Conversation
02fd8b1
to
1bd0e2a
Compare
Codecov Report
@@ Coverage Diff @@
## master #4724 +/- ##
==========================================
- Coverage 54.61% 53.96% -0.65%
==========================================
Files 414 414
Lines 53516 53515 -1
==========================================
- Hits 29228 28881 -347
- Misses 21864 22199 +335
- Partials 2424 2435 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1bd0e2a
to
ddcf616
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good simple change except I don't like the dbCtx
-> ctx
rename
ledger/catchpointtracker.go
Outdated
@@ -1107,7 +1107,7 @@ func (ct *catchpointTracker) generateCatchpointData(ctx context.Context, account | |||
var catchpointWriter *catchpointWriter | |||
start := time.Now() | |||
ledgerGeneratecatchpointCount.Inc(nil) | |||
err := ct.dbs.Rdb.Atomic(func(dbCtx context.Context, tx *sql.Tx) (err error) { | |||
err := ct.dbs.Rdb.AtomicContext(ctx, func(ctx context.Context, tx *sql.Tx) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is less clear because it shadows the outer function's param ctx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, fixed!
Summary
Atomic() doesn't accept a context, but always passes context.Background() to the callback fn.
This PR adds AtomicContext() that does accept a context and passes it to its callback.
Replaces #4104