Daniel
03/10/2023, 6:12 PMsuspend fun Logout(token: String) {
val userId = appService.currentUser!!.id ///// this will execute 1st
realm.write { ///// this will execute 2nd
var user = query<UserInfo>("_id = $0", userId).first().find()
if (user != null) {
user = findLatest(user)!!.also {
it.FCMToken.remove(token)
}
copyToRealm(user)
}
}
withContext(Dispatchers.Default) { ///// this will execute 3rd
realm.syncSession.uploadAllLocalChanges() ///// this will execute 4rd
appService.currentUser?.logOut() ///// this will execute 5th
}
}
Are they executed in a linear way?streetsofboston
03/10/2023, 6:19 PMuli
03/13/2023, 8:50 AMephemient
03/13/2023, 3:36 PMNonCancellable
(what if the app is killed?), so you have some way of recovering from interruptions regardlessuli
03/13/2023, 4:56 PM