Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Ignacio Vimberg jivimberg

View GitHub Profile
@jivimberg
jivimberg / CoroutinesUtils.kt
Last active Mar 25, 2021
SQS Consumer using Kotlin coroutines and pool of workers.
View CoroutinesUtils.kt
package com.jivimberg.sqs.published
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.isActive
import kotlinx.coroutines.yield
import java.lang.Thread.currentThread
suspend fun CoroutineScope.repeatUntilCancelled(block: suspend () -> Unit) {
while (isActive) {