mirror of
https://github.com/danog/amp.git
synced 2024-11-26 20:15:00 +01:00
Micro-optimize interval = 0 if
This commit is contained in:
parent
38ef4d9ffa
commit
ef6c2b10ee
@ -59,9 +59,7 @@ class EvDriver extends Driver {
|
|||||||
|
|
||||||
if ($watcher->type & Watcher::DELAY) {
|
if ($watcher->type & Watcher::DELAY) {
|
||||||
$this->cancel($watcher->id);
|
$this->cancel($watcher->id);
|
||||||
}
|
} elseif ($watcher->value === 0) {
|
||||||
|
|
||||||
if ($watcher->type & Watcher::REPEAT && $watcher->value === 0) {
|
|
||||||
// Disable and re-enable so it's not executed repeatedly in the same tick
|
// Disable and re-enable so it's not executed repeatedly in the same tick
|
||||||
// See https://github.com/amphp/amp/issues/131
|
// See https://github.com/amphp/amp/issues/131
|
||||||
$this->disable($watcher->id);
|
$this->disable($watcher->id);
|
||||||
|
@ -88,9 +88,7 @@ class UvDriver extends Driver {
|
|||||||
if ($watcher->type & Watcher::DELAY) {
|
if ($watcher->type & Watcher::DELAY) {
|
||||||
unset($this->events[$watcher->id], $this->watchers[(int) $event]); // Avoid call to uv_is_active().
|
unset($this->events[$watcher->id], $this->watchers[(int) $event]); // Avoid call to uv_is_active().
|
||||||
$this->cancel($watcher->id); // Remove reference to watcher in parent.
|
$this->cancel($watcher->id); // Remove reference to watcher in parent.
|
||||||
}
|
} elseif ($watcher->value === 0) {
|
||||||
|
|
||||||
if ($watcher->type & Watcher::REPEAT && $watcher->value === 0) {
|
|
||||||
// Disable and re-enable so it's not executed repeatedly in the same tick
|
// Disable and re-enable so it's not executed repeatedly in the same tick
|
||||||
// See https://github.com/amphp/amp/issues/131
|
// See https://github.com/amphp/amp/issues/131
|
||||||
$this->disable($watcher->id);
|
$this->disable($watcher->id);
|
||||||
|
Loading…
Reference in New Issue
Block a user