Skip to content

[16.0][FIX] lighting_export_xlsx: fix serialization error on concurrent attachment write#92

Merged
eantones merged 1 commit into16.0from
16.0-fix-lighting_export_xlsx-concurrent_write
Mar 25, 2026
Merged

[16.0][FIX] lighting_export_xlsx: fix serialization error on concurrent attachment write#92
eantones merged 1 commit into16.0from
16.0-fix-lighting_export_xlsx-concurrent_write

Conversation

@eantones
Copy link
Copy Markdown
Member

Summary

  • Fix SerializationFailure when another worker modifies the same attachments during the long export transaction
  • The ORM write({"public": True}) creates dirty records that conflict during flush_all() at batch boundaries
  • Use raw SQL to bypass ORM dirty record tracking — the UPDATE executes immediately

Test plan

  • Export all products while other users are active on the system

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.63%. Comparing base (d8349d7) to head (7a0be38).
⚠️ Report is 5 commits behind head on 16.0.

Files with missing lines Patch % Lines
lighting_export_xlsx/models/product_attachment.py 0.00% 4 Missing ⚠️
lighting_export_xlsx/report/export_product_xlsx.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             16.0      #92      +/-   ##
==========================================
- Coverage   43.66%   43.63%   -0.04%     
==========================================
  Files         283      283              
  Lines        8093     8099       +6     
  Branches     1562     1564       +2     
==========================================
  Hits         3534     3534              
- Misses       4464     4470       +6     
  Partials       95       95              

☔ View full report in Codecov by Sentry.
📢 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.

@eantones eantones force-pushed the 16.0-fix-lighting_export_xlsx-concurrent_write branch 8 times, most recently from 4328024 to c708d6d Compare March 25, 2026 18:06
… loop

The ORM write for setting attachments as public during export created
dirty records that conflicted with concurrent workers during
flush_all/invalidate_all at batch boundaries (SerializationFailure).

Move the public write out of the per-product loop entirely. Instead,
do a single search + write after all product data is generated. This
keeps the batch loop read-only and avoids concurrent access issues.
@eantones eantones force-pushed the 16.0-fix-lighting_export_xlsx-concurrent_write branch from c708d6d to 7a0be38 Compare March 25, 2026 18:09
@eantones eantones merged commit 54d5b44 into 16.0 Mar 25, 2026
4 checks passed
@eantones eantones deleted the 16.0-fix-lighting_export_xlsx-concurrent_write branch March 25, 2026 18:12
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.

1 participant