kriswallsmith / spork

Experimental library for forking PHP
MIT License
587 stars 52 forks source link

Fixed potential wrong $limit parameter in the child cursor if a $limit i... #21

Closed yvann closed 9 years ago

yvann commented 10 years ago

Fixed potential wrong $limit parameter in the child cursor if a $limit is provided to the parent.

A problem occured when i passed a cursor with a defined limit.

// Parent cursor with a limit
$items = $documentManager->getRepository('...')->findBy(array())->limit(50);

$self = $this;
$this->spork->process(
    $items,
    function($item, $index, $batch, $fifo) use ($self) {
        $self->process($item);
    },
    new DoctrineMongoStrategy(2)
);

And i would like to have the following forks: [0-25[ [25-50[

Thanks for this very useful library !

yvann commented 10 years ago

Tests are coming !

kriswallsmith commented 9 years ago

Thanks!