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

Look into avoiding to start timers if timeout is small #6

Closed
clue opened this issue Jun 30, 2015 · 3 comments
Closed

Look into avoiding to start timers if timeout is small #6

clue opened this issue Jun 30, 2015 · 3 comments

Comments

@clue
Copy link
Member

clue commented Jun 30, 2015

No description provided.

@clue
Copy link
Member Author

clue commented Jul 4, 2015

This library should try to handle this so that the timer will be invoked as soon as possible after the time interval expired. This means that we can not give any guarantees beyond what the underlying timer implementation already provides.

Suggested behavior:

  • If passing a time interval of 1.0 seconds, invoke the timer at least 1.0 seconds later (close approximation).
  • If passing a time interval of 0.000001 seconds, invoke the timer at least 0.000001 seconds later (probably more like 0.001 seconds).
  • If passing a time interval of 0.0 seconds, invoke the timer at least 0.0 seconds later (propably more like 0.001 seconds).
  • If passing a time internal of -1.0 seconds, invoke the timer at least 0.0 seconds later (probably more like 0.001 seconds).

Negative timeout values could be considered an invalid value. However, they're often the result of some time difference computation, so (IMO) it should be safe to pass them to this lib.

@clue
Copy link
Member Author

clue commented Aug 1, 2015

Suggested behavior: […]

This is already supported with react/event-loop v0.4, so there's really nothing to be done here for any recent version :)

However, this does not currently work with react/event-loop v0.3 because it throws an Exception when starting a timer < 0.001s.

I'll look into how much sense it makes to add a BC layer like the following:

if (defined('\React\EventLoop\Timer\Timers::MIN_INTERVAL')) {
    $time = max($time, \React\EventLoop\Timer\Timers::MIN_INTERVAL);
}

@clue
Copy link
Member Author

clue commented Mar 13, 2016

However, this does not currently work with react/event-loop v0.3 because it throws an Exception when starting a timer < 0.001s.

I've filed a PR here: reactphp/event-loop#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant