vuongxuongminh / laravel-async

Package provide simple way to run code asynchronously for your Laravel application.
MIT License
154 stars 26 forks source link

Not work with async #5

Closed santutu closed 4 years ago

santutu commented 4 years ago

image

image image

Expect work time is 1second but 2second. Do you know what do i wrong?

hannanstd commented 3 years ago

hi i had this issue. what is the soloution?

vuongxuongminh commented 3 years ago

Hi @hannanstd, Are you have PCNTL extension?, What's your OS?

hannanstd commented 3 years ago

@vuongxuongminh yes it is enabled. i use ubuntu 20 and apache2 on localhost, nginx on production server. 1

vuongxuongminh commented 3 years ago

Can you show your running code?

hannanstd commented 3 years ago

thanks for your help. 2 3

vuongxuongminh commented 3 years ago

You're welcome, How about posix extension? Are you install it?

hannanstd commented 3 years ago

i guess the problem. when is use php -i | grep pcntl it shows support => enabled , but when is use extension_loaded('pcntl') it returns false

hannanstd commented 3 years ago

that problem was solved by reinstalling pcntl. but now the results is null.

20

vuongxuongminh commented 3 years ago

Can you share your code? Like above but loop 20?

hannanstd commented 3 years ago

yes 21

vuongxuongminh commented 3 years ago

Maybe an exception have been throw, try to run:

Async::run(function() {

}, [
     'error' => function(\Exception $e) {
        dump($e);
    }
]);

If exception throw, please ensure your package version's latest: composer show vxm/laravel-async

hannanstd commented 3 years ago

yes. i had an error. the error: "PHP Warning: Module 'pcntl' already loaded in Unknown on line 0

i fixed it and now all things is okey.

i prepared an installation guide for instal PCNTL on ubuntu and hopefull for other users: https://stackoverflow.com/a/64634134/6937189

thanks alot for yout awesome package.