-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate ticker channels into structured concurrency and flows #540
Comments
@elizarov is this coming? Currently trying to build coroutine-based background processing but having a time-keeping channel will simplify a number of things. |
@wyaeld Yes. Ticker channels will become a part of Can you, please, write more details on what kind of background processing you are doing and what are your use-cases for time-keeping channels. |
Sure. I'm reading through all the Flow docs this week to understand how
that works, since that was my assumption on how you would do it.
In my case I'm writing at IoT control element, which is continually
processing commands that get delivered in batches, and for which I want an
observer/reporting type element that is able to report say every 10s, on
the status of everything in flight. This command batches can be hundreds
of individual messages that have to go out. The TickerChannel seemed like
a useful trigger for the reporting element.
…On Tue, 3 Sep 2019 at 23:16, Roman Elizarov ***@***.***> wrote:
@wyaeld <https://github.com/wyaeld> Yes. Ticker channels will become a
part of Flow framework. Yet, this is not going to happen in the
short-term future. Actually, flows makes it so easy to write this kind of
things yourself, as to almost remove the need for any kind of library
primitive.
Can you, please, write more details on what kind of background processing
you are doing and what are your use-cases for time-keeping channels.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540?email_source=notifications&email_token=AABGNUETUV3I64VUOU3NUFLQHZBP3A5CNFSM4FUBJY2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5X3NOI#issuecomment-527414969>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABGNUANWPIBKEPFFMDVIIDQHZBP3ANCNFSM4FUBJY2A>
.
|
Will ticker channels be multiplatform? I came from this issue |
Yes. The plan is to have them flow-based an multiplatform. |
Are there any updates? We'd like to use this feature in an app displaying a one-time-password for two-step-verification similar to the google authenticator Usually, OTPs are valid 30 seconds, and "start" on a full minute or on a half minute, In the moment we're using rx-java and emit:
|
If you want another use-case: I'm writing a daemon which periodically checks the audio graph of an (external) PipeWire daemon, and creates or deletes links based on a user-defined ruleset. public fun main(): Unit = runBlocking {
JVMSoundController().use { soundController ->
embeddedServer(Netty, port = wsProtocolPort) {
// ... (the other half of my app, a WebSocket server for remote control)
}.start()
flow {
while (true) {
emit(Unit)
delay(3.seconds)
}
}.collect {
soundController.checkLocks()
}
}
} |
|
Hi guys. |
We need to integrate ticker channels into a structured concurrency story to make sure they are not lost running forever. They should be somehow marked as "daemon" (?) children of their parent and should not prevent the parent completion, but shall be cancelled when all other (non-daemon?) children coroutines complete. This would make standard timing-related operations easy to write in a less error-prone way.
P.S. This is not critical for 1.0 release, since the API for channels is going to be kept experimental anyway.
The text was updated successfully, but these errors were encountered: