Skip to content

Commit 877ced2

Browse files
author
Anton Shabovta
committed
Timeout function removed
1 parent 1bc1f86 commit 877ced2

File tree

2 files changed

+0
-64
lines changed

2 files changed

+0
-64
lines changed

examples/timeout.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/Action.php

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -66,44 +66,6 @@ public function cancel(string $reason = null): self
6666
return $this;
6767
}
6868

69-
/**
70-
* @param int $timeout
71-
*
72-
* @return self
73-
*/
74-
public function timeout(int $timeout): self
75-
{
76-
$deferred = new Deferred;
77-
$resolved = false;
78-
79-
$watcher = Loop::delay($timeout, function () use ($deferred, &$resolved) {
80-
if ($resolved) {
81-
return;
82-
}
83-
84-
$resolved = true;
85-
86-
$deferred->fail(new Exception\ActionTimeout((string) $this->id));
87-
});
88-
89-
$promise = $this->promise;
90-
$promise->onResolve(function () use ($deferred, $watcher, &$resolved) {
91-
if ($resolved) {
92-
return;
93-
}
94-
95-
$resolved = true;
96-
97-
Loop::cancel($watcher);
98-
99-
$deferred->resolve($this->promise);
100-
});
101-
102-
$this->promise = $deferred->promise();
103-
104-
return $this;
105-
}
106-
10769
/**
10870
* {@inheritdoc}
10971
*/

0 commit comments

Comments
 (0)