Last active
October 23, 2019 20:12
-
-
Save volgar1x/b7e4253322abd7b8414d3fe7d9ae2cc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ctx.upstream().transact { | |
post(..., 10.second) | |
post(...) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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