Repository navigation
v1.2.1: don't fold deliberately isolated scopes into the outer dispatch - #3
Merged
Merged
Conversation
…outer dispatch; v1.2.1 In 1.2.0, while a dispatch was in flight, any nested Send/Publish reused its scope, including one made through a mediator resolved from a scope the handler created itself to get its own DbContext. Only a mediator resolved from the in-flight scope (the ISender/IPublisher injected into a handler) now joins it; any other mediator starts its own dispatch scope.
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.
Summary
With
UseScopePerDispatch, 1.2.0 reused the in-flight dispatch scope for any nestedSend/Publish. That included one made through a mediator resolved from a scope the handler had created on purpose to get its ownDbContext, so the isolated work silently landed back on the outerDbContext.Now only a mediator resolved from the in-flight scope (the
ISender/IPublisherinjected into a handler) joins it; any other mediator starts its own dispatch scope. Apps that don't callUseScopePerDispatchare unaffected.Mediator.Dispatch: reuse only when_provideris the active dispatch scopeA_send_through_a_scope_the_handler_created_itself_is_not_folded_into_the_outer_dispatchThis branch is based on
docs/upgrading-to-1.2(#2) because it adds a 1.2.1 entry to the changelog introduced there. Merge #2 first, or merge this and close #2.Test plan
Assert.NotSame– same instance) and passes with the fix