diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-12-01 22:07:24 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-12-03 10:46:15 +0000 |
| commit | bf8b2e4081e29b4706a3be4d983b2aca85509cbf (patch) | |
| tree | 6e50dd51c6cf182884ec454cc6f2269f84f0c0dc /android/src/main | |
| parent | c1d99182ab2acaf2432de0992f835dcffa6e3aef (diff) | |
| download | mullvadvpn-bf8b2e4081e29b4706a3be4d983b2aca85509cbf.tar.xz mullvadvpn-bf8b2e4081e29b4706a3be4d983b2aca85509cbf.zip | |
Run location info. cache fetches in the background
Diffstat (limited to 'android/src/main')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt index acfb93296b..38e0dc209a 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/service/LocationInfoCache.kt @@ -138,7 +138,7 @@ class LocationInfoCache( val fetchId = newFetchId() val previousFetch = activeFetch - activeFetch = GlobalScope.launch(Dispatchers.Main) { + activeFetch = GlobalScope.launch(Dispatchers.Default) { val delays = ExponentialBackoff().apply { scale = 50 cap = 30 /* min */ * 60 /* s */ * 1000 /* ms */ @@ -151,7 +151,7 @@ class LocationInfoCache( while (newLocation == null && fetchId == fetchIdCounter) { delay(delays.next()) - newLocation = executeFetch().await() + newLocation = daemon.getCurrentLocation() } synchronized(this@LocationInfoCache) { @@ -165,8 +165,4 @@ class LocationInfoCache( } } } - - private fun executeFetch() = GlobalScope.async(Dispatchers.Default) { - daemon.getCurrentLocation() - } } |
