-
Notifications
You must be signed in to change notification settings - Fork 231
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
INTENG-21262 Fix for Duplicate purchase events (cached). #1433
INTENG-21262 Fix for Duplicate purchase events (cached). #1433
Conversation
-> Remove archived request file from disk when those req. are added in queue for processing on app launch. -> When persist timer is fired and req queue is empty, delete cache file from disk. persistImmediately func was earlier returning without updating cache if req queue was empty. -> Added check fileExistsAtPath before removing it in func removeSaveFile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing with the current SDK and this branch, i was able to see the issue before but now it appears to be fixed.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1433 +/- ##
==========================================
- Coverage 51.10% 50.96% -0.14%
==========================================
Files 66 66
Lines 10158 10273 +115
Branches 3724 3775 +51
==========================================
+ Hits 5191 5236 +45
- Misses 4707 4777 +70
Partials 260 260
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Reference
https://branch.atlassian.net/browse/INTENG-21262
Summary
Issue : SDK sends Duplicate purchase events on cold launch of app if network request processing failed in previous launches.
SDK archives a copy of its Request Queue on Disk. Its a txt file (
BNCServerRequestQueue
)stored inside theApplication Support
folder of the data container of app. This archived copy is updated at regular intervals using a timer.When app is cold launched, SDK reads this file and adds requests left unprocessed from last run in its Request Queue.
Because of a bug in SDK, this archived file was not deleted from disk if current request queue is empty. As a result, SDK keeps sending these cached requests on every cold launch of app.
Steps for reproducing bug :
Type Of Change
Testing Instructions
-> Check all unit tests pass.
-> Verify fix -
- Create
BNCServerRequestQueue
archive file using steps mentioned above (Steps 1-4). On my system its stored at path/Users/nidhi.dixit/Library/Developer/CoreSimulator/Devices/9C999B8A-A12B-4DDC-9A7E-A7F9DE201024/data/Containers/Data/Application/FD451857-78A8-4C5A-88C3-7CC9932D931C/Library/Application\ Support/io.branch
. I am testing using simulator.- Cold Lauch App and check all failed requests in previous launch are processed.
BNCServerRequestQueue
file is deleted / updated and it does not contain processed requests anymore.- Cold Launch App again and check SDK is not sending duplicate purchase events.
cc @BranchMetrics/saas-sdk-devs for visibility.