fix: use automatic transaction commit in provider update handler

The provider update handler was missing proper transaction handling,
causing quota deductions to be lost. This fix uses session.begin()
context manager for automatic commit/rollback, ensuring provider
quota updates are properly persisted.

Fixes #24356
This commit is contained in:
-LAN- 2025-08-22 21:18:45 +08:00
parent 7f7156b325
commit 9704319e10
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF
1 changed files with 1 additions and 1 deletions

View File

@ -188,7 +188,7 @@ def _execute_provider_updates(updates_to_perform: list[_ProviderUpdateOperation]
# Use SQLAlchemy's context manager for transaction management
# This automatically handles commit/rollback
with Session(db.engine) as session:
with Session(db.engine) as session, session.begin():
# Use a single transaction for all updates
for update_operation in updates_to_perform:
filters = update_operation.filters