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

Cancellation of promise collections #36

Merged
merged 6 commits into from Mar 24, 2016

Conversation

Projects
None yet
4 participants
@jsor
Member

jsor commented Jul 6, 2015

Allow cancellation of promises returned by functions working on promise collections.

Closes #33

@jsor jsor referenced this pull request Jul 6, 2015

Closed

Support collection operations #15

@jsor jsor changed the title from [WIP] Cancellation of promise collections to Cancellation of promise collections Jul 7, 2015

@Adirelle

This comment has been minimized.

Adirelle commented on src/CancellationQueue.php in d177dd9 Jul 11, 2015

What about this ?

while ($promise = array_shift($this->queue)) {
  $promise->cancel();
}

This comment has been minimized.

Member

jsor replied Jul 13, 2015

I've taken the code from

private function drain()
{
for ($i = key($this->queue); isset($this->queue[$i]); $i++) {
$task = $this->queue[$i];
$exception = null;
try {
$task();
} catch (\Exception $exception) {
}
unset($this->queue[$i]);
if ($exception) {
throw $exception;
}
}
$this->queue = [];
}

To be honest, i'm not sure anymore why i've taken that approach. I've changed it here and over at the global-queue branch.

@jsor

This comment has been minimized.

Member

jsor commented Sep 7, 2015

ping for review @cboden @clue @WyriHaximus
Also, should this go in 2.3 or 3.0?

@WyriHaximus

This comment has been minimized.

Member

WyriHaximus commented Sep 9, 2015

LGTM, 2.3 👍 (unless I missed something there isn't any BC break so 2.3 seems more appropriate then 3.0)

Revert "Simplify queue draining code"
This reverts commit 173d8f9.

Note: The task must be kept on the queue until after it is called.
Otherwise drain() will be called recursively.

@jsor jsor added this to the v3.0 milestone Jan 21, 2016

@jsor

This comment has been minimized.

Member

jsor commented Jan 21, 2016

I'm planning to add this to 3.0.

@clue

This comment has been minimized.

Member

clue commented Jan 22, 2016

Changes LGTM 👍 Personally, I would tend towards getting this into v2.3 first and then subsequently into v3.0

@jsor jsor removed this from the v3.0 milestone Mar 24, 2016

@jsor jsor merged commit 38b4c2c into master Mar 24, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jsor jsor deleted the collection-cancellation branch Mar 25, 2016

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