Skip to content
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

FOREVER PENDING #148

Closed
yonathanYPP opened this issue May 19, 2021 · 2 comments
Closed

FOREVER PENDING #148

yonathanYPP opened this issue May 19, 2021 · 2 comments

Comments

@yonathanYPP
Copy link

$searchs = explode(' ', $request->search);

    $pool = Pool::create();

    foreach ($searchs as $search) {
        $pool->add(function () use ($search) {
            $input = [
                'keyword' => $search
            ];
            $this->keywordService->firstOrCreate($input);
        })->catch(function (Throwable $exception) use ($pool) {
            $log = [
                'message' => $exception->getMessage()
            ];
            $KeywordAsyncLog = new Logger('KeywordAsync');
            $KeywordAsyncLog->pushHandler(new StreamHandler(storage_path('logs/keyword_async.log')), Logger::INFO);
            $KeywordAsyncLog->info('keyword_async_log', $log);
        });
    }

    $pool->wait();

those code result is forever waiting

@spacemudd
Copy link

The $this variable will be undefined and thus hanging. You're starting a new PHP process which means you lose your context.

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants