Skip to content

Improve signals dispatching #1343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 11, 2020
Merged

Conversation

yuri-sergiichuk
Copy link
Contributor

@yuri-sergiichuk yuri-sergiichuk commented Dec 10, 2020

This PR fixes #1318.

In the PR I have relaxed the HandlerMap check on missing handlers while it is totally OK to not have a specific handler within a specific class. It's then up to the caller to verify and check how to behave when a handler is missing. In our case, all the respective callers already do check and filter out situations when no handlers are available. The only change one may notice is the error text available via the HandlerFailedUnexpectedly event, instead of the IllegalStateException, we'll see the EventValidationError with the UNSUPPORTED_EVENT code.

@yuri-sergiichuk yuri-sergiichuk self-assigned this Dec 10, 2020
@codecov
Copy link

codecov bot commented Dec 10, 2020

Codecov Report

Merging #1343 (4bd38de) into master (29e6531) will increase coverage by 0.07%.
The diff coverage is 92.85%.

@@             Coverage Diff              @@
##             master    #1343      +/-   ##
============================================
+ Coverage     90.98%   91.05%   +0.07%     
+ Complexity     4768     4767       -1     
============================================
  Files           614      614              
  Lines         15139    15135       -4     
  Branches        860      858       -2     
============================================
+ Hits          13774    13781       +7     
+ Misses         1090     1085       -5     
+ Partials        275      269       -6     

@yuri-sergiichuk yuri-sergiichuk marked this pull request as ready for review December 10, 2020 17:36
@yuri-sergiichuk
Copy link
Contributor Author

@armiol PTAL.

Copy link
Contributor

@armiol armiol left a comment

Choose a reason for hiding this comment

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

@yuri-sergiichuk LGTM with a minor comment to address.

.map(StateSubscriberMethod::stateType)
.map(StateClass::from)
.collect(toImmutableSet());
ImmutableSet<StateClass> result = stateHandlers
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please format it like this:

        ImmutableSet<StateClass> result =
                stateHandlers
                        .stream()
                        .filter(StateSubscriberMethod.class::isInstance)
                        .map(StateSubscriberMethod.class::cast)
                        .filter(external ? HandlerMethod::isExternal : HandlerMethod::isDomestic)
                        .map(StateSubscriberMethod::stateType)
                        .map(StateClass::from)
                        .collect(toImmutableSet());

@yuri-sergiichuk yuri-sergiichuk merged commit e60650d into master Dec 11, 2020
@yuri-sergiichuk yuri-sergiichuk deleted the improve-signals-dispatching branch December 11, 2020 13:59
@yuri-sergiichuk yuri-sergiichuk mentioned this pull request Dec 14, 2020
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.

@Subscribe-r of the rejection caused by a particular command causes the dispatching failure in some cases
2 participants