CustomerInfoManager: post notification when CustomerInfo changes#2057
CustomerInfoManager: post notification when CustomerInfo changes#2057NachoSoto wants to merge 1 commit into
CustomerInfoManager: post notification when CustomerInfo changes#2057Conversation
3eddf69 to
2f68cc7
Compare
eca596c to
bbec345
Compare
aboedo
left a comment
There was a problem hiding this comment.
I think there could be cases where we're not invalidating correctly
There was a problem hiding this comment.
Curious about this, why don't we reuse this mechanism for getting notified about changes, instead of adding the notificationCenter notification?
There was a problem hiding this comment.
For one because this was checking only when active subscriptions changed.
Now that I'm changing the cache invalidation to checking CustomerInfo changes we could.
However, this is used by #2007. Using a notification makes it a lot simpler so that we don't have to manually couple TrialOrIntroPriceEligibilityChecker to CustomerInfoManager. What do you think?
There was a problem hiding this comment.
Bump @aboedo
I addressed your comments 10 days ago.
There was a problem hiding this comment.
the part that I find a bit concerning is that we have 2 things updating from a change in customerInfo, but we don't have much control over the ordering.
if we're using this for cache invalidation, doesn't it mean that it's possible that you have a closure coming in from here that uses an outdated cache of intro eligibility values?
There was a problem hiding this comment.
The 2 sources is a valid concern. I think they serve different purposes though.
The notification pattern is useful for 1-N notifications without strongly coupling types, and it simplifies the hierarchy. The current dependency injection approach is prone to retain cycles and leaks as exposed in the other PRs.
As for ordering, I'm not sure that's an issue in this case. Not sure what you mean exactly. #2007 won't recreate the eligibility, simply invalidate the cache for the next time it's requested.
CustomerInfoManager: post notification when CustomerInfo subscriptions changeCustomerInfoManager: post notification when CustomerInfo changes
bbec345 to
a9938b8
Compare
|
Updated this to post a notification any time |
|
Bump @aboedo |
a9938b8 to
376e162
Compare
|
Closing this, will replace #2007 with using the existing observation methods. |
This will be used for #2007.