Changeset View
Changeset View
Standalone View
Standalone View
src/future/FutureIterator.php
| Show First 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | public function rewind() { | ||||
| $this->next(); | $this->next(); | ||||
| } | } | ||||
| /** | /** | ||||
| * @task iterator | * @task iterator | ||||
| */ | */ | ||||
| public function next() { | public function next() { | ||||
| // See T13572. If we preivously resolved and returned a Future, release | |||||
| // it now. This prevents us from holding Futures indefinitely when callers | |||||
| // like FuturePool build long-lived iterators and keep adding new Futures | |||||
| // to them. | |||||
| if ($this->key !== null) { | |||||
| unset($this->futures[$this->key]); | |||||
| $this->key = null; | $this->key = null; | ||||
| } | |||||
| $this->updateWorkingSet(); | $this->updateWorkingSet(); | ||||
| if (!$this->work) { | if (!$this->work) { | ||||
| return; | return; | ||||
| } | } | ||||
| $start = microtime(true); | $start = microtime(true); | ||||
| ▲ Show 20 Lines • Show All 258 Lines • Show Last 20 Lines | |||||