mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-22 16:00:03 +02:00
![]() - Older code (154 places to be exact) that want to do transactions uses `TxContext`. If the context is not already in a transaction then it uses `DefaultContext` for the new transaction. - Not reusing the context it was given leads to two problems: for tracing (forgejo/forgejo#6470) any SQL code that is executed inside this transaction is not shown in the trace. If the context is cancelled then the transaction is not cancelled and will always complete (given there's no SQL error). - When this function was introduced it didn't take a parent context, hence the usage of `DefaultContext`. When `parentCtx` was introduced it was only used to avoid nested transactions and use the parent's transaction. I do not see any reasons why the parent context cannot be reused, it is reused in the newer transaction function `WithTx` without any known problems. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8464 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Gusted <postmaster@gusted.xyz> Co-committed-by: Gusted <postmaster@gusted.xyz> |
||
---|---|---|
.. | ||
install | ||
paginator | ||
collation.go | ||
common.go | ||
consistency.go | ||
context.go | ||
context_committer_test.go | ||
context_test.go | ||
convert.go | ||
engine.go | ||
engine_test.go | ||
error.go | ||
index.go | ||
index_test.go | ||
iterate.go | ||
iterate_test.go | ||
list.go | ||
list_test.go | ||
log.go | ||
main_test.go | ||
name.go | ||
search.go | ||
sequence.go | ||
sql_postgres_with_schema.go | ||
table_names_test.go |