-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Check for network connectivity before requesting resources #6123
Conversation
… avoid unnecessary HTTPRequests
@zugaldia, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh, @bleege and @tmpsantos to be potential reviewers. |
I refactored things to use an As for the stacktrace that's in the OP, I'm also seeing that too when I test the map tile requests but not when testing it in the |
@zugaldia Took a little look and it's a Since the constructor gets aborted here the Add in a null check on On a side note, I'm not a big fan of things called |
@bleege Thanks for bringing the implementation to the Telemetry. @ivovandongen Thanks for finding the cause for the Waiting for CI and for your final 👀 before merging. |
Agreed. The thinking was to be consistent with the existing |
Right, maybe we could generalize |
First attempt at adding an
isConnected()
method toMapboxAccountManager
to avoid unnecessaryHTTPRequest
s. We're usingMapboxAccountManager
to host this method because 1) it contains aContext
instance, 2) it's easy to access statically viagetInstance()
and 3) is available before actual requests from the map are trigged.Strangely, this works when an Internet connection is available but when a connection isn't available, the SDK crashes with the following exception:
TODO
MapboxEventManager
too.This fixes #6042.
@ivovandongen @bleege I'd love your 👀 here.
/cc: @danswick