Skip to content

Commit abdbc8d

Browse files
committed
Limit timer interval at PHP_INT_MAX
1 parent e060da5 commit abdbc8d

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ install:
2929
- travis/install-ev.sh
3030
- travis/install-event.sh
3131

32-
- composer update -n --prefer-dist
32+
- composer update -n --prefer-source
3333

3434
- curl -OL https://github.com/php-coveralls/php-coveralls/releases/download/v1.0.0/coveralls.phar
3535
- chmod +x coveralls.phar

src/ReactAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function addTimer($interval, $callback): TimerInterface
9595
{
9696
$timer = new Timer($interval, $callback, false);
9797

98-
$watcher = $this->driver->delay((int) \ceil(1000 * $timer->getInterval()), function () use ($timer, $callback) {
98+
$watcher = $this->driver->delay((int) \min(\PHP_INT_MAX, \ceil(1000 * $timer->getInterval())), function () use ($timer, $callback) {
9999
$this->cancelTimer($timer);
100100

101101
$callback($timer);
@@ -112,7 +112,7 @@ public function addPeriodicTimer($interval, $callback): TimerInterface
112112
{
113113
$timer = new Timer($interval, $callback, true);
114114

115-
$watcher = $this->driver->repeat((int) \ceil(1000 * $timer->getInterval()), function () use ($timer, $callback) {
115+
$watcher = $this->driver->repeat((int) \min(\PHP_INT_MAX, \ceil(1000 * $timer->getInterval())), function () use ($timer, $callback) {
116116
$callback($timer);
117117
});
118118

0 commit comments

Comments
 (0)