Use for a repo action one database transaction#19576
Conversation
|
|
Co-authored-by: delvh <dev.lh@web.de>
|
tip use |
|
@wxiaoguang I did the merge into a db.WithTx() ... so the scope of the transaction now should be clear :) |
wxiaoguang
left a comment
There was a problem hiding this comment.
It seems that err = db.WithTx(...); if err != nil {} could be easier to read than if db.WithTx(....) != nil { } when the func code are very long.
|
@6543 do you have plan to use If yes, let's wait for the change. |
it has to do something with how notification package is handled
|
next deadlock: |
…e merge infoce internal api that cant handle open db sessions to the same repo
|
🚀 |
|
-> #19596 ... |
* giteaofficial/main: Fix broken TR on cherrypick page (go-gitea#19599) Use correct context in `routers/web` (go-gitea#19597) Use for a repo action one database transaction (go-gitea#19576) Only set CanColorStdout / CanColorStderr to true if the stdout/stderr is a terminal (go-gitea#19581) Don't fetch Mirror when it's migrating (go-gitea#19588) Move user password verification after checking his groups on ldap auth (go-gitea#19587)
... more context (part of go-gitea#9307)
|
|
||
| pr.MergedCommitID, err = rawMerge(ctx, pr, doer, mergeStyle, expectedHeadCommitID, message) | ||
| // TODO: make it able to do this in a database session | ||
| mergeCtx := context.Background() |
There was a problem hiding this comment.
We should NEVER use context.Background()!
| // TODO: this cause an api call to "/api/internal/hook/post-receive/...", | ||
| // that prevents us from doint the whole merge in one db transaction |
There was a problem hiding this comment.
If you know that you don't want our hooks to run you could have used the InternalPushingEnvironment
... more context
(part of #9307)