Skip to content
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

Please, clarify description for Stream.timeout() #30163

Closed
alsemenov opened this issue Jul 14, 2017 · 1 comment
Closed

Please, clarify description for Stream.timeout() #30163

alsemenov opened this issue Jul 14, 2017 · 1 comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-a library-async type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-documentation A request to add or improve documentation

Comments

@alsemenov
Copy link
Contributor

The description for Stream.timeout() reads:

Stream<T> timeout(
Duration timeLimit, {
void onTimeout(
EventSink<T> sink
)
})
Creates a new stream with the same events as this stream.

Whenever more than timeLimit passes between two events from this stream, the onTimeout function is called.

The countdown doesn't start until the returned stream is listened to. The countdown is reset every time an event is forwarded from this stream, or when the stream is paused and resumed.

The onTimeout function is called with one argument: an EventSink that allows putting events into the returned stream. This EventSink is only valid during the call to onTimeout.

If onTimeout is omitted, a timeout will just put a TimeoutException into the error channel of the returned stream.

The returned stream is a broadcast stream if this stream is. If a broadcast stream is listened to more than once, each subscription will have its individually timer that starts counting on listen, and the subscriptions' timers can be paused individually.

  1. Please, explicitly specify at which moments countdown starts and stops.
    For example:

Whenever more than timeLimit passes between two events from this stream, the onTimeout function is called.

The countdown doesn't start until the returned stream is listened to.

It is easy to conclude from this, that countdown starts on first event, which is wrong, I believe.

The countdown is reset every time an event is forwarded from this stream, or when the stream is paused and resumed.

I believe, 'reset' means 'set countdown to initial value (i.e. timeLimit)', but is the countdown stopped or started or it state does not change? especially in cases of stream paused or resumed actions?

What happens with countdown, when it reaches zero? Does countdown stopps or starts again with initial value?

  1. Please, clarify the case if onTimeout throws error. Is this error added to the returned stream?
@lrhn lrhn added area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-async type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-documentation A request to add or improve documentation labels Jul 14, 2017
@kleeb
Copy link

kleeb commented Dec 13, 2020

any more details pls ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-a library-async type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-documentation A request to add or improve documentation
Projects
None yet
Development

No branches or pull requests

4 participants