Skip to content
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

meta/sql: simplify transaction for single query #5377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

davies
Copy link
Contributor

@davies davies commented Dec 13, 2024

No description provided.

@davies davies requested a review from zhijian-pro December 13, 2024 07:19
func (m *dbMeta) simpleTxn(ctx context.Context, f func(s *xorm.Session) error) error {
start := time.Now()
defer func() { m.txDist.Observe(time.Since(start).Seconds()) }()
s := m.db.NewSession()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there are no transactions, perhaps NewSession does not need to be used every time, just use one globally or xorm.Engine direct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants