1
1
mirror of https://github.com/go-gitea/gitea.git synced 2024-10-02 04:41:46 +02:00
gitea/models/db
Jason Song a35714372d
Fix halfCommitter and WithTx (#22366)
Related to #22362.

I overlooked that there's always `committer.Close()`, like:

```go
		ctx, committer, err := db.TxContext(db.DefaultContext)
		if err != nil {
			return nil
		}
		defer committer.Close()

		// ...

		if err != nil {
			return nil
		}

		// ...

		return committer.Commit()
```

So the `Close` of `halfCommitter` should ignore `commit and close`, it's
not a rollback.

See: [Why `halfCommitter` and `WithTx` should rollback IMMEDIATELY or
commit
LATER](https://github.com/go-gitea/gitea/pull/22366#issuecomment-1374778612).

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-01-09 12:19:19 -05:00
..
install
paginator
common.go
consistency.go
context_committer_test.go Fix halfCommitter and WithTx (#22366) 2023-01-09 12:19:19 -05:00
context_test.go
context.go Fix halfCommitter and WithTx (#22366) 2023-01-09 12:19:19 -05:00
convert.go
engine_test.go
engine.go
error.go
index_test.go
index.go
iterate_test.go
iterate.go
list_options.go
log.go
main_test.go
name.go
search.go
sequence.go
sql_postgres_with_schema.go