Make index dispatches failure-safe (and confirm async marker interface)#158
Open
loevgaard wants to merge 1 commit into
Open
Make index dispatches failure-safe (and confirm async marker interface)#158loevgaard wants to merge 1 commit into
loevgaard wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## issue-112-incremental-default-filters #158 +/- ##
========================================================================
Coverage ? 45.91%
Complexity ? 749
========================================================================
Files ? 133
Lines ? 2450
Branches ? 0
========================================================================
Hits ? 1125
Misses ? 1325
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cc64906 to
df8d23f
Compare
ae8d80e to
74ad191
Compare
df8d23f to
6952c4f
Compare
Every save of an indexable entity dispatches on the plugin's command bus, which (with no transport routing) runs synchronously inside the Doctrine flush. If Meilisearch was slow or down, saving/deleting a product failed. EntityListener now wraps every dispatch in try/catch and logs the error at error level (dedicated setono_sylius_meilisearch monolog channel), so a search-index hiccup — or a transport outage on an async setup — can never break catalog management. All plugin command messages already share the CommandInterface marker, so a single framework.messenger.routing entry can route everything to an async transport (documented separately in the operational-model docs). Closes #124
74ad191 to
dfea6c9
Compare
6952c4f to
be49d96
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Out of the box every save of an indexable entity dispatches on the plugin's command bus, and since no transport routing is configured, the handler runs synchronously inside the Doctrine flush. If Meilisearch was slow or down, saving/deleting a product failed — a search-index hiccup broke catalog management.
Two parts:
EntityListenernow wraps every dispatch intry/catchand logs the failure aterror(dedicatedsetono_sylius_meilisearchMonolog channel). A failed index update — or a transport outage on an async setup — can never break the entity save it reacts to.CommandInterfacemarker (directly or viaEntityAwareCommand), so a singleframework.messenger.routingentry can route everything to an async transport. The recommended routing snippet is documented in the operational-model docs issue ([Docs]: Document the operational model - async indexing, settings sync, production checklist #140).Testing
EntityListenerTest::it_swallows_and_logs_a_failing_dispatch_so_the_entity_save_still_succeeds: with the command bus throwing,postPersistdoes not throw and anerroris logged.Closes #124
Stacked on #157 (#112).