I love the notion of tasks, especially for large processes, but I've found that their isn't a lot of documentation around it which makes trouble shooting them via an authoritative source difficult.
A few things I've found out that I had misconceptions on:
- A task is one request, no matter how many steps it has, that runs in the background.
- Sub tasks are all part of that initial task's one request
- Since a task is a single request it is subjected to the same PHP Limitations that a normal request would be (i.e., memory limit) (this really comes into play when important large amounts of data in a dev environment because there's a lot of information that's being logged via a single request -- could be 100s of MB of log files in request
Some things I'm still confused about:
Does a task run with a separate session ID and thread than the browser that initiated the task via the CP request? I've noticed using the Power Nap plugin that if I initiate the running of task via a CP request I can navigate to other pages while the task is still running, but with other plugins that import Commerce data, I have to wait until the entire import is done before I can navigate to another page.
Do multiple queued tasks all get a single request or are they lumped into a single request?
If I need to insert thousands of entries is it more performant / desirable to place all entries in a single task or queue a task for each entry?
I'm sure their will be more, but I definitely think a single location for figuring out the benefits / use cases / pitfalls of Craft Tasks will be hugely beneficial.
Thanks in advance for the discussion.