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

Repeated calls to api/v1/sdk/events/blacklist when internet connection offline #70

Closed
measuredweighed opened this issue Jan 12, 2024 · 1 comment

Comments

@measuredweighed
Copy link

When a users internet connection is offline Adapty SDK is making repeated calls to the https://api.adapty.io/api/v1/sdk/events/blacklist/ endpoint on launch, causing EventManager.trackEvent to peg the CPU.

We initialise Adapty in our UIApplicationDelegate's func application(_ application:, didFinishLaunchingWithOptions launchOptions:) like so:

Adapty.activate("X", observerMode: true)

This is the only call made to Adapty before the requests start. To replicate this you can follow the following steps:

  1. Turn on Airplane mode
  2. Start an application that makes use of the Adapty iOS SDK

Ideally a failure to fetch the events/blacklist would result in an exponential backoff, rather than repeated re-attempts.

logs
Task <AB7BCD97-98C1-45DB-9F83-88EDF1382F13>.<4920> finished with error [-1009] 
Error Domain=NSURLErrorDomain Code=-1009 "The internet connection appears to be offline."
 UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x280b573f0 
 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorDomainKey=1, 
 _kCFStreamErrorCodeKey=50, _NSURLErrorNWResolutionReportKey=Resolved 0 endpoints in 0ms 
 using unknown from cache, _NSURLErrorNWPathKey=unsatisfied (No network route)}}, 
 _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <AB7BCD97-98C1-45DB-9F83-88EDF1382F13>.<4920>,
 _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <AB7BCD97-98C1-45DB-9F83-88EDF1382F13>.<4920>"
), NSLocalizedDescription=The internet connection appears to be offline., 
NSErrorFailingURLStringKey=https://api.adapty.io/api/v1/sdk/events/blacklist/, 
NSErrorFailingURLKey=https://api.adapty.io/api/v1/sdk/events/blacklist/, _kCFStreamErrorDomainKey=1}
Connection 4943: received failure notification
Connection 4943: failed to connect 1:50, reason -1
Connection 4943: encountered error(1:50)
@x401om
Copy link
Contributor

x401om commented Jan 17, 2024

Hi, @measuredweighed! Thanks for pointing out the issue, we've fixed it in version 2.9.3. Really appreciate your help in making our SDK better!

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

No branches or pull requests

2 participants