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

Fix issues with CustomerSession listeners #856

Merged
merged 2 commits into from
Apr 9, 2019

Commits on Apr 9, 2019

  1. Fix issues with CustomerSession listeners

    **Motivation**
    The previous implementation of `CustomerSession` listeners
    had a reference to a single `CustomerRetrievalListener` and
    `SourceRetrievalListener`. After a listener is called, it
    would be nulled out.
    
    This logic was buggy because it resulted in possible race
    conditions in which two calls are both in flight, and the
    first call that completes nulls out the listener for the
    second.
    
    **Summary**
    The solution to this issue is to associate an `operationId`
    (i.e. UUID) with each listener. This avoids the race condition
    and ambiguity about which listener is being referenced.
    
    Additionally, the listeners were being held with a strong
    reference, which could lead to memory leaks if the listener
    held a reference to an Activity.
    
    **Testing**
    Manually verified with samplestore and example apps.
    mshafrir-stripe committed Apr 9, 2019
    Configuration menu
    Copy the full SHA
    4107a3e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e2bee47 View commit details
    Browse the repository at this point in the history