amphp / parallel-functions

Simplified parallel processing for PHP based on Amp.
https://amphp.org/parallel-functions
MIT License
268 stars 18 forks source link

Uncaught Error in worker with message "Class 'common\models\Sha256Block' not found" and code "0"; use Amp\Parallel\Worker\TaskError::getWorkerTrace() fo r the stack trace in the worker #15

Closed s-fog closed 4 years ago

s-fog commented 5 years ago

Hi guys. Please help me. Use example of ur script. Promise\wait(parallelMap([0, 1, 2], function ($part)) { new \common\models\Sha256Block; })); And i catch this problem. Read all what i can. I cant connect Class into this function. Who knows issue?

trowski commented 4 years ago

Any code used within the Closure must be autoloadable by the composer autoloader or preloaded using a bootstrap file. You can specify a bootstrap file using BootstrapWorkerFactory and setting the global worker factory.

Amp\Parallel\Worker\factory(
    new Amp\Parallel\Worker\BootstrapWorkerFactory('/path/to/bootstrap.php')
);
kelunik commented 4 years ago

There hasn't been any further activity, so I'm closing this issue. Please comment with further information, we can always reopen the issue.