You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've decided it would be good to make a dedicated issue explaining about what this package does and doesn't do. Lots of people open keep opening the same kind of issue, so I hope to explain it once and for all in this one.
Sometimes your async tasks don't work, they throw strange errors and what not. It's important to realise how tasks are run asynchronously. Each task is a new PHP process created on the fly, which can execute time-consuming code. This package aims to run these kinds of time consuming tasks in parallel, so that instead of waiting 60 seconds for 10 6-seconds tasks to finish, you could run 10 processes at the same time, finishing the task in 6 seconds (actually it's a little more because process management also adds some overhead).
That's rule number one: this package is only useful if you're dealing with several tasks which take at least a few seconds each to process.
So what about strange errors you don't understand? Since parallel tasks are executed in their own process, there's no concept of a booted framework. I often see people trying to use Laravel models in tasks, while they don't realise Laravel doesn't exist in these child processes. You can of course boot Laravel, or whatever framework you want, manually in child processes, though chances are your use case isn't what this package is meant for.
That's rule number two: parallel tasks are run in clean PHP processes, there's no concept of a framework unless you boot it manually within that task.
In case you need lots of framework-specific functionality, I'd suggest to first look at the existing queueing systems of your framework, instead of using this package.
The text was updated successfully, but these errors were encountered:
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.
I've decided it would be good to make a dedicated issue explaining about what this package does and doesn't do. Lots of people open keep opening the same kind of issue, so I hope to explain it once and for all in this one.
Sometimes your async tasks don't work, they throw strange errors and what not. It's important to realise how tasks are run asynchronously. Each task is a new PHP process created on the fly, which can execute time-consuming code. This package aims to run these kinds of time consuming tasks in parallel, so that instead of waiting 60 seconds for 10 6-seconds tasks to finish, you could run 10 processes at the same time, finishing the task in 6 seconds (actually it's a little more because process management also adds some overhead).
That's rule number one: this package is only useful if you're dealing with several tasks which take at least a few seconds each to process.
So what about strange errors you don't understand? Since parallel tasks are executed in their own process, there's no concept of a booted framework. I often see people trying to use Laravel models in tasks, while they don't realise Laravel doesn't exist in these child processes. You can of course boot Laravel, or whatever framework you want, manually in child processes, though chances are your use case isn't what this package is meant for.
That's rule number two: parallel tasks are run in clean PHP processes, there's no concept of a framework unless you boot it manually within that task.
In case you need lots of framework-specific functionality, I'd suggest to first look at the existing queueing systems of your framework, instead of using this package.
The text was updated successfully, but these errors were encountered: