Skip to content

Only fire order recalculated events after save#6447

Open
jarednorman wants to merge 1 commit intosolidusio:mainfrom
SuperGoodSoft:order-updated-event-timing
Open

Only fire order recalculated events after save#6447
jarednorman wants to merge 1 commit intosolidusio:mainfrom
SuperGoodSoft:order-updated-event-timing

Conversation

@jarednorman
Copy link
Copy Markdown
Member

Summary

The events should be published only once the transaction has completed, so any jobs fired from subscribers see the new version of the order. Also, the event bus has a job-backed backend (that I'm not sure anyone uses) so this should also fix race conditions with that.

Besides fixing race conditions with subscribers, this also ensure we don't fire the event when the order is not being persisted.

@jarednorman jarednorman requested a review from a team as a code owner April 23, 2026 07:37
@github-actions github-actions Bot added the changelog:solidus_core Changes to the solidus_core gem label Apr 23, 2026
@jarednorman jarednorman changed the title Only fire order updated events after save Only fire order recalculated events after save Apr 23, 2026
The events should be published only once the transaction has completed,
so any jobs fired from subscribers see the new version of the order.
Also, the event bus has a job-backed backend (that I'm not sure anyone
uses) so this should also fix race conditions with that.

Besides fixing race conditions with subscribers, this also ensure we
don't fire the event when the order is *not* being persisted.
@jarednorman jarednorman force-pushed the order-updated-event-timing branch from 1dc997b to 9a2cda1 Compare April 23, 2026 07:39
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.66%. Comparing base (20161a3) to head (9a2cda1).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6447   +/-   ##
=======================================
  Coverage   89.66%   89.66%           
=======================================
  Files         990      990           
  Lines       20792    20793    +1     
=======================================
+ Hits        18644    18645    +1     
  Misses       2148     2148           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

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

Thanks.

@tvdeyen
Copy link
Copy Markdown
Member

tvdeyen commented Apr 23, 2026

@jarednorman worth back porting to 4.7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog:solidus_core Changes to the solidus_core gem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants