Kris Wong
01/13/2020, 8:45 PMbasher
01/13/2020, 8:46 PMKris Wong
01/13/2020, 8:46 PMKris Wong
01/13/2020, 8:47 PMbasher
01/13/2020, 8:47 PMbasher
01/13/2020, 8:47 PMKris Wong
01/13/2020, 8:48 PMbasher
01/13/2020, 8:49 PMKris Wong
01/13/2020, 8:49 PMbasher
01/13/2020, 8:53 PMDominaezzz
01/13/2020, 8:56 PMDominaezzz
01/13/2020, 8:57 PMKris Wong
01/13/2020, 8:57 PMbasher
01/13/2020, 8:58 PMval memberLambda = this.memberLambda
and freeze the val, that should get you out of that no?Dominaezzz
01/13/2020, 8:58 PMDominaezzz
01/13/2020, 8:58 PMKris Wong
01/13/2020, 8:59 PMKris Wong
01/13/2020, 8:59 PMKris Wong
01/13/2020, 9:00 PMkpgalligan
01/13/2020, 9:10 PMkpgalligan
01/13/2020, 9:11 PMsuspend fun updateFavorite(breedId: Long, favorite: Boolean) = withContext(Dispatchers.Default) {
dbRef.tableQueries.updateFavorite(favorite.toLong(), breedId)
}
Kris Wong
01/13/2020, 9:12 PMkpgalligan
01/13/2020, 9:13 PMKris Wong
01/13/2020, 9:16 PMDominaezzz
01/13/2020, 9:16 PMKris Wong
01/13/2020, 9:17 PMKris Wong
01/13/2020, 9:19 PMCloseable
objectskpgalligan
01/13/2020, 9:25 PMKris Wong
01/13/2020, 9:26 PMKris Wong
01/13/2020, 9:27 PMKris Wong
01/13/2020, 9:28 PM@ThreadLocal object HttpClientProvider {
val client = HttpClient()
}
Kris Wong
01/13/2020, 9:28 PMDominaezzz
01/13/2020, 9:33 PMKris Wong
01/13/2020, 9:43 PMKris Wong
01/13/2020, 9:44 PMkpgalligan
01/13/2020, 9:47 PMclient
, they initiate an async call on the underlying network provider, then suspend. Unless you’re doing heavy processing on the response, I don’t think initiating calls on a background thread does much.kpgalligan
01/13/2020, 9:48 PMkpgalligan
01/13/2020, 9:48 PMClosable
is to shut down the client after you’re dong using it?Kris Wong
01/13/2020, 9:49 PMKris Wong
01/13/2020, 9:49 PMkpgalligan
01/13/2020, 9:49 PMkpgalligan
01/13/2020, 9:50 PMKris Wong
01/13/2020, 9:50 PMKris Wong
01/13/2020, 9:50 PMkpgalligan
01/13/2020, 9:55 PMKris Wong
01/13/2020, 9:59 PMkpgalligan
01/13/2020, 9:59 PMkpgalligan
01/13/2020, 10:00 PMKris Wong
01/13/2020, 10:00 PMKris Wong
01/13/2020, 10:02 PMKris Wong
01/13/2020, 10:03 PMkpgalligan
01/13/2020, 10:04 PMKris Wong
01/13/2020, 10:04 PMkpgalligan
01/13/2020, 10:04 PMKris Wong
01/13/2020, 10:05 PMKris Wong
01/13/2020, 10:06 PMsuspend
functions end up getting removed from the native targetskpgalligan
01/13/2020, 10:08 PMkpgalligan
01/13/2020, 10:08 PMKris Wong
01/13/2020, 10:09 PMbasher
01/13/2020, 10:43 PMbasher
01/13/2020, 10:44 PMinterface Network
that each platform implements natively and provides and implementation for at library initArkadii Ivanov
01/14/2020, 10:28 AMKris Wong
01/15/2020, 3:10 PMkpgalligan
01/15/2020, 3:11 PMkpgalligan
01/15/2020, 3:12 PMkpgalligan
01/15/2020, 3:12 PMkpgalligan
01/15/2020, 3:14 PMKris Wong
01/15/2020, 3:14 PMkpgalligan
01/15/2020, 3:15 PMbasher
01/15/2020, 4:17 PMKris Wong
01/15/2020, 4:21 PMbasher
01/15/2020, 4:23 PM.execute
or .withContext
will get you a thread in the thread pool. which one isn't guaranteed. suspending while on one of those threads and then resuming will return you back to that thread. Does that help?Kris Wong
01/15/2020, 4:27 PMbasher
01/15/2020, 4:36 PMKris Wong
01/15/2020, 4:39 PM