class SearchUpdateCommitJobProcessor implements QueuedJob (View source)

Properties

protected array $indexes

List of indexes to commit

protected bool $skipped

True if this job is skipped to be be re-scheduled in the future

protected array $completed

List of completed indexes

protected array $messages

List of messages

public static array $dirty_indexes

List of dirty indexes to be committed

public static bool $has_run

True if any commits have been executed this request. If so, any attempts to run subsequent commits should be delayed until next queuedjob to prevent solr reaching maxWarmingSearchers

Methods

public static 
int
queue(bool $dirty = true, string $startAfter = null)

This method is invoked once indexes with dirty ids have been updapted and a commit is necessary

public
getJobType()

What type of job is this? Options are

  • QueuedJob::IMMEDIATE
  • QueuedJob::QUEUED
  • QueuedJob::LARGE

public
string
getSignature()

Gets a unique signature for this job and its current parameters.

public
string
getTitle()

Gets a title for the job that can be used in listings

public
array
getAllIndexes()

Get the list of index names we should process

public
jobFinished()

Returns true or false to indicate that this job is finished

public
prepareForRestart()

Called whenever a job is restarted for whatever reason.

public
afterComplete()

No description

protected
discardJob()

Abort this job, potentially rescheduling a replacement if there is still work to do

public
process()

A job is run within an external processing loop that will call this method while there are still steps left to complete in the job.

protected
commitIndex(SolrIndex $index)

Commits a specific index

public
setup()

Setup this queued job. This is only called the first time this job is executed (ie when currentStep is 0)

public
getJobData()

Return the current job state as an object containing data

public
setJobData(int $totalSteps, int $currentStep, bool $isComplete, stdClass $jobData, array $messages)

Sets data about the job

public
addMessage(string $message, $severity = 'INFO')

Add an arbitrary text message into a job

public
getMessages()

No description

Details

static int queue(bool $dirty = true, string $startAfter = null)

This method is invoked once indexes with dirty ids have been updapted and a commit is necessary

Parameters

bool $dirty

Marks all indexes as dirty by default. Set to false if there are known comitted and clean indexes

string $startAfter

Start date

Return Value

int

The ID of the next queuedjob to run. This could be a new one or an existing one.

getJobType()

What type of job is this? Options are

  • QueuedJob::IMMEDIATE
  • QueuedJob::QUEUED
  • QueuedJob::LARGE

string getSignature()

Gets a unique signature for this job and its current parameters.

This is used so that a job isn't added to a queue multiple times - this for example, an indexing job might be added every time an item is saved, but it isn't processed immediately. We dont NEED to do the indexing more than once (ie the first indexing will still catch any subsequent changes), so we don't need to have it in the queue more than once.

If you have a job that absolutely must run multiple times, the AbstractQueuedJob class provides a time sensitive randomSignature() method that can be used for returning a random signature each time

Return Value

string

string getTitle()

Gets a title for the job that can be used in listings

Return Value

string

array getAllIndexes()

Get the list of index names we should process

Return Value

array

jobFinished()

Returns true or false to indicate that this job is finished

prepareForRestart()

Called whenever a job is restarted for whatever reason.

This is a separate method so that broken jobs can do some fixup before restarting.

afterComplete()

No description

protected discardJob()

Abort this job, potentially rescheduling a replacement if there is still work to do

process()

A job is run within an external processing loop that will call this method while there are still steps left to complete in the job.

Typically, this method should process just a small amount of data - after calling this method, the process loop will save the current state of the job to protect against potential failures or errors.

protected commitIndex(SolrIndex $index)

Commits a specific index

Parameters

SolrIndex $index

Exceptions

Exception

setup()

Setup this queued job. This is only called the first time this job is executed (ie when currentStep is 0)

getJobData()

Return the current job state as an object containing data

stdClass ( 'totalSteps' => the total number of steps in this job - this is relayed to the user as an indicator of time 'currentStep' => the current number of steps done so far. 'isComplete' => whether the job is finished yet 'jobData' => data that the job wants persisted when it is stopped or started 'messages' => a cumulative array of messages that have occurred during this job so far )

setJobData(int $totalSteps, int $currentStep, bool $isComplete, stdClass $jobData, array $messages)

Sets data about the job

is an inverse of the getJobData() method, but being explicit about what data is set

Parameters

int $totalSteps
int $currentStep
bool $isComplete
stdClass $jobData
array $messages

addMessage(string $message, $severity = 'INFO')

Add an arbitrary text message into a job

Parameters

string $message
$severity

getMessages()

No description