From faf1555b9cbc3fed55f8c2715d0dcef1fa6377a4 Mon Sep 17 00:00:00 2001 From: Aaron Piotrowski Date: Wed, 26 Jul 2017 00:41:00 -0500 Subject: [PATCH] Move TaskRunner out of Internal namespace --- bin/worker | 2 +- lib/Worker/{Internal => }/TaskRunner.php | 9 ++++----- lib/Worker/WorkerThread.php | 1 - 3 files changed, 5 insertions(+), 7 deletions(-) rename lib/Worker/{Internal => }/TaskRunner.php (82%) diff --git a/bin/worker b/bin/worker index 4832077..2a88e59 100644 --- a/bin/worker +++ b/bin/worker @@ -41,7 +41,7 @@ ob_start(function ($data) { Amp\Loop::run(function () { $channel = new Sync\ChannelledSocket(STDIN, STDOUT); $environment = new Worker\BasicEnvironment; - $runner = new Worker\Internal\TaskRunner($channel, $environment); + $runner = new Worker\TaskRunner($channel, $environment); try { $result = new Sync\Internal\ExitSuccess(yield $runner->run()); diff --git a/lib/Worker/Internal/TaskRunner.php b/lib/Worker/TaskRunner.php similarity index 82% rename from lib/Worker/Internal/TaskRunner.php rename to lib/Worker/TaskRunner.php index 329a056..94e0d80 100644 --- a/lib/Worker/Internal/TaskRunner.php +++ b/lib/Worker/TaskRunner.php @@ -1,10 +1,9 @@ channel->receive(); - while ($job instanceof Job) { + while ($job instanceof Internal\Job) { $task = $job->getTask(); $result = call([$task, 'run'], $this->environment); $result->onResolve(function ($exception, $value) use ($job) { if ($exception) { - $result = new TaskFailure($job->getId(), $exception); + $result = new Internal\TaskFailure($job->getId(), $exception); } else { - $result = new TaskSuccess($job->getId(), $value); + $result = new Internal\TaskSuccess($job->getId(), $value); } $this->channel->send($result); diff --git a/lib/Worker/WorkerThread.php b/lib/Worker/WorkerThread.php index a937439..8140bfe 100644 --- a/lib/Worker/WorkerThread.php +++ b/lib/Worker/WorkerThread.php @@ -3,7 +3,6 @@ namespace Amp\Parallel\Worker; use Amp\Parallel\Threading\Thread; -use Amp\Parallel\Worker\Internal\TaskRunner; use Amp\Promise; /**