Skip to content

expicitly commit db operations in shuttle#351

Merged
elfkuzco merged 1 commit into
mainfrom
commit-shuttle-operations
Jun 22, 2026
Merged

expicitly commit db operations in shuttle#351
elfkuzco merged 1 commit into
mainfrom
commit-shuttle-operations

Conversation

@elfkuzco

Copy link
Copy Markdown
Contributor

Changes

  • use manual session instead of a transaction within shuttle and call commit after every operation

This fixes #350

@elfkuzco elfkuzco self-assigned this Jun 22, 2026
@elfkuzco elfkuzco requested a review from benoit74 June 22, 2026 08:49
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 47.36842% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.86%. Comparing base (557bddc) to head (3cc3885).

Files with missing lines Patch % Lines
backend/src/cms_backend/shuttle/move_files.py 0.00% 12 Missing ⚠️
.../cms_backend/mill/process_zimfarm_notifications.py 0.00% 7 Missing ⚠️
...ms_backend/mill/mark_staging_books_for_deletion.py 0.00% 6 Missing ⚠️
...rc/cms_backend/mill/process_title_modifications.py 72.72% 3 Missing ⚠️
backend/src/cms_backend/mill/main.py 0.00% 1 Missing ⚠️
backend/src/cms_backend/shuttle/main.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #351      +/-   ##
==========================================
- Coverage   81.87%   81.86%   -0.01%     
==========================================
  Files          60       60              
  Lines        3205     3209       +4     
  Branches      334      334              
==========================================
+ Hits         2624     2627       +3     
- Misses        485      486       +1     
  Partials       96       96              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benoit74 benoit74 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extend this to the mill.

Is this really working when you have multiple "things" to process? I thought SQLAlchemy would complain you have commit the session and trying to do modifications afterwards ... Does SQLAlchemy automatically reopen a new session implicitely?

@elfkuzco

elfkuzco commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Is this really working when you have multiple "things" to process? I thought SQLAlchemy would complain you have commit the session and trying to do modifications afterwards ... Does SQLAlchemy automatically reopen a new session implicitely?

I did try it for one book by making a backup. Verifying with multiple objects

@elfkuzco

Copy link
Copy Markdown
Contributor Author

Tried it and it worked. Sent notifications by wiping the DB and re-processing

[2026-06-22 14:31:00,061: DEBUG] Executing task: process_zimfarm_notifications
[2026-06-22 14:31:00,061: INFO] Processing Zimfarm notifications
[2026-06-22 14:31:00,063: DEBUG] Processing Zimfarm notification e38ae7b2-dd4d-4670-9932-0567f62f27ee
[2026-06-22 14:31:00,127: DEBUG] Processing Zimfarm notification 82dc63ef-6a32-4977-9692-3aa63c99bdf9
[2026-06-22 14:31:00,147: DEBUG] Processing Zimfarm notification ee8a009b-8548-4504-bde8-c727c5abd123
[2026-06-22 14:31:00,154: INFO] Done processing 3 Zimfarm notifications
[2026-06-22 14:31:00,155: DEBUG] Executing task: process_title_modifications
[2026-06-22 14:31:00,155: INFO] Processing title modification events
[2026-06-22 14:31:00,155: INFO] Done processing 0 title modification events.

@elfkuzco elfkuzco requested a review from benoit74 June 22, 2026 14:35

@benoit74 benoit74 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you

@elfkuzco elfkuzco force-pushed the commit-shuttle-operations branch from 00822e0 to a6913aa Compare June 22, 2026 15:54
@elfkuzco elfkuzco force-pushed the commit-shuttle-operations branch from a6913aa to 3cc3885 Compare June 22, 2026 15:55
@elfkuzco elfkuzco merged commit 904db9e into main Jun 22, 2026
3 of 5 checks passed
@elfkuzco elfkuzco deleted the commit-shuttle-operations branch June 22, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shuttle should commit to changes at every operation

2 participants