Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/./../app/.././../../finland.picotech.app/public_html/storage/../vendor/./nikic/../dompdf/../alexandr-mironov/../monolog/../unicodeveloper/../dragonmantank/../nunomaduro/../mockery/../phar-io/../mockery/../laravel/prompts/../octane/src
الملفات الموجودة في هذا الـ Path:
.
..
ApplicationFactory.php
ApplicationGateway.php
Cache
Commands
Concerns
Contracts
CurrentApplication.php
DispatchesEvents.php
Events
Exceptions
Exec.php
Facades
Listeners
MarshalsPsr7RequestsAndResponses.php
MimeType.php
Octane.php
OctaneResponse.php
OctaneServiceProvider.php
PosixExtension.php
RequestContext.php
RoadRunner
SequentialCoroutineDispatcher.php
SequentialTaskDispatcher.php
Stream.php
Swoole
SymfonyProcessFactory.php
Tables
Testing
Worker.php
WorkerExceptionInspector.php

مشاهدة ملف: SequentialTaskDispatcher.php

<?php

namespace Laravel\Octane;

use Laravel\Octane\Contracts\DispatchesTasks;
use Laravel\Octane\Exceptions\TaskExceptionResult;
use Throwable;

class SequentialTaskDispatcher implements DispatchesTasks
{
    /**
     * Concurrently resolve the given callbacks via background tasks, returning the results.
     *
     * Results will be keyed by their given keys - if a task did not finish, the tasks value will be "false".
     *
     *
     * @throws \Laravel\Octane\Exceptions\TaskException
     * @throws \Laravel\Octane\Exceptions\TaskTimeoutException
     */
    public function resolve(array $tasks, int $waitMilliseconds = 1): array
    {
        return collect($tasks)->mapWithKeys(
            fn ($task, $key) => [$key => (function () use ($task) {
                try {
                    return $task();
                } catch (Throwable $e) {
                    report($e);

                    return TaskExceptionResult::from($e);
                }
            })()]
        )->each(function ($result) {
            if ($result instanceof TaskExceptionResult) {
                throw $result->getOriginal();
            }
        })->all();
    }

    /**
     * Concurrently dispatch the given callbacks via background tasks.
     */
    public function dispatch(array $tasks): void
    {
        try {
            $this->resolve($tasks);
        } catch (Throwable) {
            // ..
        }
    }
}