forgejo_backup/models/db
Gusted 7cd313951a fix: use parent context for new transactions (#8464)
- 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>
2025-07-10 14:07:18 +02:00
..
install fix: make installing Forgejo work again (#7452) 2025-04-04 03:30:19 +00:00
paginator chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
collation.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
common.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
consistency.go Implement FSFE REUSE for golang files (#21840) 2022-11-27 18:20:29 +00:00
context.go fix: use parent context for new transactions (#8464) 2025-07-10 14:07:18 +02:00
context_committer_test.go chore: use errors.New to replace fmt.Errorf with no parameters (#32800) 2024-12-15 09:15:57 +01:00
context_test.go fix: use parent context for new transactions (#8464) 2025-07-10 14:07:18 +02:00
convert.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
engine.go chore: do not require empty fixtures to clean tables (#8353) 2025-06-30 23:04:16 +02:00
engine_test.go fix various typos (#7690) 2025-04-28 06:46:29 +00:00
error.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
index.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
index_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
iterate.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
iterate_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
list.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
list_test.go feat: use XORM EngineGroup instead of single Engine connection (#7212) 2025-03-30 11:34:02 +00:00
log.go chore(cleanup): suppress non actionable XORM warnings (#8021) 2025-05-30 13:01:08 +02:00
main_test.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
name.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
search.go [Refactor] Unify repo search order by logic (#30876) 2024-06-16 13:42:58 +02:00
sequence.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
sql_postgres_with_schema.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
table_names_test.go chore: do not require empty fixtures to clean tables (#8353) 2025-06-30 23:04:16 +02:00