Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Last active October 23, 2019 20:12
Show Gist options
  • Save volgar1x/b7e4253322abd7b8414d3fe7d9ae2cc1 to your computer and use it in GitHub Desktop.
Save volgar1x/b7e4253322abd7b8414d3fe7d9ae2cc1 to your computer and use it in GitHub Desktop.
ctx.upstream().transact {
post(..., 10.second)
post(...)
}
suspend fun Context.post(msg: Message, ts: TimeSpan? = null) {
withTimeoutOrNull(ts ?? 5.second) {
post(msg)
}
}
suspend fun Context.transact(transaction: suspend Context.() => Unit) {
transaction(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment