createInvoicedoes not need to set a dispatcher becausepostInvoiceis a suspending function that does not block threads.sendEmailneeds to set the dispatcher toDispatchers.IOor a custom dispatcher with a thread limit becauseapiis a blocking function.getUserOrdersdoes not need to set a dispatcher becausetoListis a suspending function that does not block threads.upscaleImageneeds to set the dispatcher toDispatchers.DefaultorDispatchers.Defaultlimited to a certain number of threads because upscaling an image is a CPU-intensive operation.
The author:
Marcin Moskala is a highly experienced developer and Kotlin instructor as the founder of Kt. Academy, an official JetBrains partner specializing in Kotlin training, Google Developers Expert, known for his significant contributions to the Kotlin community. Moskala is the author of several widely recognized books, including "Effective Kotlin," "Kotlin Coroutines," "Functional Kotlin," "Advanced Kotlin," "Kotlin Essentials," and "Android Development with Kotlin."
Beyond his literary achievements, Moskala is the author of the largest Medium publication dedicated to Kotlin. As a respected speaker, he has been invited to share his insights at numerous programming conferences, including events such as Droidcon and the prestigious Kotlin Conf, the premier conference dedicated to the Kotlin programming language.