I am working a lot with cronjobs, to not slow down my website when calling heavy processes. While this works solid, it's also getting a bit messy and I see that the core offers an ultra professional way of handling jobs. 😲 But there is not much documentation. @datakick Can you give me a short overview, how this is working and what be the simplest implentation to start with?
This is, what I believe at the moment:
I need to implement WorkQueueTaskCallable with one function execute().
When such a task is executed, an entry is saved to table 'ps_workqueue_task'.
When I want to such a task to be executed I need to call createTask()
There are schedulded tasks in addition, that trigger the WorkQueueTaskCallable in a certain frequency. Probably I have to implement InitializationCallback for that.
If a scheduld task was startet it's saved to 'ps_schedulded_task_execution' table
Not sure, if this is correct and probably there is much more. What I wonder:
What does actually execute the whole process? Do I need only one cronjob, that somehow fires the schedulded task? Is the TriggerController doing this from time to time as well? But why so?
Multiple cronjobs can to things parallel (at least, this is what I believe). Is this working queue the same or will one job be executed after the other? Let's say the packs quantity is updating some products, can I update on the same time currencies with a task (random example).
My goal is to cache more resources. That for I need a clever way to rebuild the cache. Do only the minimum on the fly the rest should be handled behind. For example I wan't to cache the reviews of product/category pages. When someone posts a new product review, I need to rebuild multiple caches. This working queue system should be ideal for jobs like this, right?
Question
wakabayashi
I am working a lot with cronjobs, to not slow down my website when calling heavy processes. While this works solid, it's also getting a bit messy and I see that the core offers an ultra professional way of handling jobs. 😲 But there is not much documentation. @datakick Can you give me a short overview, how this is working and what be the simplest implentation to start with?
This is, what I believe at the moment:
Not sure, if this is correct and probably there is much more. What I wonder:
1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now