Merge pull request #4307 from k9mail/fix-async-bg

Move some async jobs into background thread
This commit is contained in:
cketti 2019-11-29 12:55:20 +01:00 committed by GitHub
commit d35bee13f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -13,7 +13,7 @@ class AccountsLiveData(val preferences: Preferences) : LiveData<List<Account>>()
private fun loadAccountsAsync() { private fun loadAccountsAsync() {
GlobalScope.launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
val accounts = async { val accounts = async(Dispatchers.IO) {
loadAccounts() loadAccounts()
} }

View file

@ -18,7 +18,7 @@ import java.io.InputStream
class AutocryptSetupMessageLiveEvent(val messageCreator: AutocryptTransferMessageCreator) : SingleLiveEvent<AutocryptSetupMessage>() { class AutocryptSetupMessageLiveEvent(val messageCreator: AutocryptTransferMessageCreator) : SingleLiveEvent<AutocryptSetupMessage>() {
fun loadAutocryptSetupMessageAsync(openPgpApi: OpenPgpApi, account: Account) { fun loadAutocryptSetupMessageAsync(openPgpApi: OpenPgpApi, account: Account) {
GlobalScope.launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
val setupMessage = async { val setupMessage = async(Dispatchers.IO) {
loadAutocryptSetupMessage(openPgpApi, account) loadAutocryptSetupMessage(openPgpApi, account)
} }

View file

@ -12,7 +12,7 @@ class AutocryptSetupTransferLiveEvent(
fun sendMessageAsync(account: Account, setupMsg: AutocryptSetupMessage) { fun sendMessageAsync(account: Account, setupMsg: AutocryptSetupMessage) {
GlobalScope.launch(Dispatchers.Main) { GlobalScope.launch(Dispatchers.Main) {
val setupMessage = async { val setupMessage = async(Dispatchers.IO) {
messagingController.sendMessageBlocking(account, setupMsg.setupMessage) messagingController.sendMessageBlocking(account, setupMsg.setupMessage)
} }