Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Ignacio Vimberg jivimberg

View GitHub Profile
@jivimberg
jivimberg / CoroutinesUtils.kt
Last active Jul 7, 2020
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) {
You can’t perform that action at this time.