Skip to content

Instantly share code, notes, and snippets.

View jivimberg's full-sized avatar

Juan Ignacio Vimberg jivimberg

View GitHub Profile
@jivimberg
jivimberg / CoroutinesUtils.kt
Last active October 11, 2023 00:16
SQS Consumer using Kotlin coroutines and pool of workers.
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) {