mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
bus: dont start transaction when creating session
This commit is contained in:
parent
629eab0b1e
commit
9ca9a7c302
@ -29,7 +29,6 @@ func startSession(ctx context.Context) *DBSession {
|
||||
|
||||
if !ok {
|
||||
newSess := newSession()
|
||||
newSess.Begin()
|
||||
return newSess
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,10 @@ func (ss *SqlStore) inTransactionWithRetry(ctx context.Context, fn func(ctx cont
|
||||
sess := startSession(ctx)
|
||||
defer sess.Close()
|
||||
|
||||
if err := sess.Begin(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
withValue := context.WithValue(ctx, ContextSessionName, sess)
|
||||
|
||||
err := fn(withValue)
|
||||
@ -59,6 +63,7 @@ func inTransactionWithRetryCtx(ctx context.Context, callback dbTransactionFunc,
|
||||
var err error
|
||||
|
||||
sess := startSession(ctx)
|
||||
|
||||
defer sess.Close()
|
||||
|
||||
if err = sess.Begin(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user