fix(db): commit session in CheckpointRepository.create to prevent GC-induced data loss
CI / lint (pull_request) Successful in 24s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 58s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 47s
CI / push-validation (pull_request) Successful in 21s
CI / e2e_tests (pull_request) Successful in 4m24s
CI / integration_tests (pull_request) Successful in 4m39s
CI / unit_tests (pull_request) Successful in 5m26s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m37s
CI / benchmark-publish (pull_request) Has been skipped
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 57m17s
CI / lint (pull_request) Successful in 24s
CI / quality (pull_request) Successful in 51s
CI / typecheck (pull_request) Successful in 1m15s
CI / security (pull_request) Successful in 58s
CI / helm (pull_request) Successful in 30s
CI / build (pull_request) Successful in 47s
CI / push-validation (pull_request) Successful in 21s
CI / e2e_tests (pull_request) Successful in 4m24s
CI / integration_tests (pull_request) Successful in 4m39s
CI / unit_tests (pull_request) Successful in 5m26s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m37s
CI / benchmark-publish (pull_request) Has been skipped
CI / status-check (pull_request) Successful in 1s
CI / benchmark-regression (pull_request) Successful in 57m17s
Without an explicit session.commit(), the session created by create() could be garbage-collected before prune() runs its query, causing the StaticPool connection to be returned to the pool and the pending transaction to be rolled back. This made prune() see an empty table and return [] instead of the expected pruned IDs. Adding session.commit() ensures the checkpoint row is durably written before the session goes out of scope, fixing the flaky CheckpointRepository prune test (features/db_repositories_cov_r3.feature:292). ISSUES CLOSED: #8759
This commit is contained in:
@@ -5628,6 +5628,7 @@ class CheckpointRepository:
|
||||
model = CheckpointModel.from_domain(checkpoint)
|
||||
session.add(model)
|
||||
session.flush()
|
||||
session.commit()
|
||||
return model.to_domain()
|
||||
except IntegrityError as exc:
|
||||
session.rollback()
|
||||
|
||||
Reference in New Issue
Block a user