Manual:Job queue/For developers

To use the job queue to do your deferred updates, you need to do these things:

Create a Job subclass
You need to create a class, that, given parameters and a Title, will perform your deferred updates

Job queue size
It’s good practice to check the overall job queue size for a specific job type before adding additional jobs of that type to the job queue; e.g., when the job queue size for your job queue type > 100. One way to handle this would be to:
 * 1) Check the job queue size of the job type you want to add.
 * 2) If the job queue size for that job type > your configured threshold:
 * 3) * create a new job that:
 * 4) contains all of the relevant information as its parameters.
 * 5) will check an attempt parameter to see how many times it has attempted to create the original job.
 * 6) * if it exceeds that configured attempt threshold it will stop attempting to create the original job.
 * 7) will check the job queue size for the original job type when it runs.
 * 8) if the job queue size < your configured threshold.
 * 9) * will create the original job.

Job queue type
A job queue type is the command name you give to the parent::__construct method of your job class; e.g., using the example above, that would be synchroniseThreadArticleData.

getQueueSizes
will return an array of all job queue types and their sizes.

getSize
While  is handy for analysing the entire job queue, for performance reasons, it’s best to use   when analysing a specific job type, which will only return the job queue size of that specific job type.