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 race condition in subscriber attributes sync #326

Merged
merged 6 commits into from
Sep 1, 2020

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Aug 28, 2020

There's a race condition present in SDK versions >= 3.5.2, where the subscriber attributes sync call might fail with a 404.
The issue is made worse by the fact that the SDK will interpret a 404 as "synced successfully".

The issue happens as follows:

  • didFinishLaunchingWithOptions
    • configure (purchaser info sync call begins on background thread)
    • subscribe a didBecomeActive
  • didBecomeActive
    • sync attributes
  • finish purchaser info call on background thread.

This PR fixes it by moving the sync attributes call to the same background thread, so that it's correctly queued after the purchaser info sync.

This PR also improves the SDK behavior for subscriber attributes 404s to not mark them as successfully synced.

@aboedo aboedo self-assigned this Aug 28, 2020
@aboedo aboedo requested a review from vegaro August 28, 2020 21:29
@aboedo aboedo mentioned this pull request Aug 28, 2020
Copy link
Contributor

@vegaro vegaro left a comment

Choose a reason for hiding this comment

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

Makes sense! I would leave the 404 specific changes for the attribution PR, but other than that :shipit:

@aboedo aboedo marked this pull request as ready for review August 31, 2020 19:05
@vegaro vegaro added this to the 3.5.3 milestone Aug 31, 2020
@aboedo aboedo requested a review from vegaro August 31, 2020 19:06
@aboedo
Copy link
Member Author

aboedo commented Aug 31, 2020

@vegaro I added tests and removed the 404 stuff, since it's being handled in #321.

@aboedo aboedo force-pushed the fix/race_condition_in_subscriber_attributes_sync branch from 8dc8e13 to aec5d3e Compare August 31, 2020 20:20
@aboedo
Copy link
Member Author

aboedo commented Sep 1, 2020

@vegaro bump

@aboedo aboedo merged commit c03c935 into develop Sep 1, 2020
@aboedo aboedo deleted the fix/race_condition_in_subscriber_attributes_sync branch September 1, 2020 22:04
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.

2 participants