coding

Automatic retry function with Kotlin flows

Automatic retry function with Kotlin flows

Table of contents Short code example Why use this? My app on the Google play store Resources Programming Android with Kotlin: Achieving Structured Concurrency with Coroutines. Chapter 10 Short code example Here is the code that will allow you to make automatic retries on a flow: fun <T, R : Any> Flow<T>.mapWithRetry( action: suspend (T) -> R, predicate: suspend (R, attempt: Int) -> Boolean ) = map { data -> var attempt = 0L var shallRetry: Boolean var lastValue: R? = null do { val tr = action(data) shallRetry = predicate(tr, (++attempt).toInt()) if (!shallRetry) lastValue = tr } while (shallRetry)…
Read More
YugabyteDB ♥️ Hashicorp Vault – Fun Times

YugabyteDB ♥️ Hashicorp Vault – Fun Times

I have been working with YugabyteDB for a while now. I am always experiment with yugbayte + (something). Today, its Vault. I have also worked on Vault for a bit and did a a lightening talk earlier this year. That talks was primarily around the data masking. But today, I was exploring the database secret engine. For the uninitiated, Vault provides you with ability to dynamically generate database credentials for your application. It does this by leveraging the simple RBAC SQLs provided by the database engine. It supports variety of databases including Postgres, and YugabyteDB by compatibility. What triggered this…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.