Open maher1337 opened 2 years ago
I can not reproduce this error. Here is my code and it can work successfully.
[$response, $result] = Octane::concurrently([
fn() => UserModel::find(1)->toArray(),
fn() => UserModel::find(2)->toArray()
]);
My Octane version is 1.1.0. Octane::concurrently require a callable array parameter. https://laravel.com/docs/8.x/octane#concurrent-tasks
Make sure you pass it through a resource with a collection
Make sure you pass it through a resource with a collection
It can work successfully too if passing it with collection.
[$response, $result] = Octane::concurrently([
fn() => UserModel::get(),
fn() => UserModel::get()
]);
var_dump($response->toArray(), $result->toArray());
Hello @NathanFreeman use an API resource. https://laravel.com/docs/8.x/eloquent-resources for more information on eloquent resources that need the model data to be passed through.
Hello @NathanFreeman use an API resource. https://laravel.com/docs/8.x/eloquent-resources for more information on eloquent resources that need the model data to be passed through.
OK, I will test it as soon as possible. Thanks.
@maher1337 Hi. Does this error occur every time when you run the code? Could you provide more information to reproduce it? It may be caused by memory error.
No it doesn't with earlier swoole version @NathanFreeman
Could you please show me the code of ApiResourceObject? Thanks!
Please answer these questions before submitting your issue. Thanks!
What did you do? If possible, provide a simple script for reproducing the error.
What did you expect to see?
The API resource mapped to the variable $response
A boolean false was returned instead
php --ri swoole
)?Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608
uname -a Linux ip-172-31-19-174 5.4.0-1030-aws #31-Ubuntu SMP Fri Nov 13 11:40:37 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux php-v PHP 8.0.13 (cli) (built: Nov 22 2021 09:50:43) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.13, Copyright (c) Zend Technologies with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
Thank you.