Skip to content

[18.0][FIX] odoo_repository: Avoid cache corruption - #155

Open
lmignon wants to merge 1 commit into
OCA:18.0from
acsone:18.0-odoo_repository-improve-cache-lmi
Open

[18.0][FIX] odoo_repository: Avoid cache corruption#155
lmignon wants to merge 1 commit into
OCA:18.0from
acsone:18.0-odoo_repository-improve-cache-lmi

Conversation

@lmignon

@lmignon lmignon commented Aug 10, 2026

Copy link
Copy Markdown

@tools.ormcache is a process-wide cache that is never invalidated by a SQL ROLLBACK. If a newly created record's id were cached from within the caller's (still uncommitted) transaction, and that transaction was later rolled back for an unrelated reason (e.g. a conflicting concurrent queue job), the cache would keep returning an id that no longer exists in the database.
This commit add a new method creating and committing the record, independently of the caller's transaction. That guarantees the returned id always stays valid, whatever happens to the caller's job afterwards.

@tools.ormcache is a process-wide cache that is never invalidated
by a SQL ROLLBACK. If a newly created record's id were cached from
within the caller's (still uncommitted) transaction, and that
transaction was later rolled back for an unrelated reason (e.g. a
conflicting concurrent queue job), the cache would keep returning an
id that no longer exists in the database.
This commit add a new method creating and committing the record,
independently of the caller's transaction. That guarantees
the returned id always stays valid, whatever happens to the caller's
job afterwards.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants