Tuan Kiet
07/24/2019, 8:32 AMGlobalScope
considered bad practice, what is the specific use case of it?gildor
07/24/2019, 8:33 AMuhe
07/24/2019, 8:34 AMGlobalScope
can always be considered bad practice.gildor
07/24/2019, 8:35 AMuhe
07/24/2019, 8:37 AMgildor
07/24/2019, 8:38 AMuhe
07/24/2019, 8:38 AMgildor
07/24/2019, 8:38 AMuhe
07/24/2019, 8:39 AMgildor
07/24/2019, 8:42 AMAntanas A.
07/24/2019, 8:42 AMGlobalScope.launch
call into explicitlyPassedScope.launch { }delay(...)
calls cannot be tested fastuhe
07/24/2019, 8:46 AMGlobalScope.launch
in your testsgildor
07/24/2019, 8:48 AMIt’s considered bad practices because you cannot control that run in your test suitesI think it’s wrong assumption. It’s bad practice because it’s global background job whicch should be explicitly handled and in most cases it may be avoided And yeah test such side effects is also probably bad practice by itself, better to test suspend functions
for example you cannot simulate time line in tests so code with someYou still can inject custom context to launch, it has nothing to do with GlobalScope, it’s the same as with any other scopecalls cannot be tested fastdelay(...)
streetsofboston
07/24/2019, 11:45 AM