Skip to content
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

Regular listeners shouldn't be called for paired response events #552

Merged
merged 4 commits into from
Mar 3, 2021

Conversation

emdobrin
Copy link
Contributor

@emdobrin emdobrin commented Feb 26, 2021

Fixes #551 and #557

@emdobrin emdobrin linked an issue Feb 26, 2021 that may be closed by this pull request
Copy link
Contributor

@nporter-adbe nporter-adbe left a comment

Choose a reason for hiding this comment

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

nice 👍🏻

@nporter-adbe
Copy link
Contributor

nporter-adbe commented Feb 27, 2021

One concern I have with this change is how response events are used in other places in the SDK.

Currently, in configuration, we dispatch a response event when the config is updated. No specific listeners are listening for the "response" event in particular. But this is still a response event to a request event, so we want to tie them together by making it a response event. This is useful in Griffon mainly and debugging.

With this change, it would appear that no other extension could actually listen for the response event coming from configuration, as no one is registered to be a response listener on the configuration request event.

On second thought, I actually think the existing behavior may be desired. I think other listeners that match the type and source should be notified of this event. But response listeners should only be invoked when the corresponding response event comes through the EventHub and ensures it is only invoked once.

https://github.com/adobe/aepsdk-core-ios/blob/main/AEPCore/Sources/configuration/Configuration.swift#L199

@shalehaha thoughts?

@nporter-adbe
Copy link
Contributor

Another example I can give is that Griffon listens for Analytics response events to tie them to Analytics request events. With this change, Griffon wouldn't be able to hear the response events as those events would only be dispatched to the paired listeners and not to every listener registered for Analytics response events.

@emdobrin
Copy link
Contributor Author

In the past we used to only send a paired response event (with responseId) when there was a getter waiting for it and that was the only listener that should have receive this event, for other updates it should a generic, non-paired response event that will be broadcasted to all the listeners interested in the event. Did this behavior change in the case of configuration 3.0.0?

@emdobrin
Copy link
Contributor Author

Griffon uses wildcard listener so the response event will be visible to it.

@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #552 (4d70803) into dev-v3.0.1 (ec88c03) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@              Coverage Diff               @@
##           dev-v3.0.1     #552      +/-   ##
==============================================
+ Coverage       84.73%   84.73%   +0.01%     
==============================================
  Files             100      100              
  Lines            4419     4427       +8     
==============================================
+ Hits             3744     3751       +7     
- Misses            675      676       +1     

@emdobrin
Copy link
Contributor Author

emdobrin commented Mar 2, 2021

@nporter-adbe @shalehaha As discussed offline, this PR makes the regular vs paired response events behavior to be in line with the ACPCore logic.
I updated my PR to include both the Core changes and the necessary configuration updates for dispatching paired responses for request events / getters and regular non-paired responses for all other config updates so all extensions can receive them. @nporter-adbe thanks for the good catch.

@shalehaha shalehaha merged commit 924cda6 into adobe:dev-v3.0.1 Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants