class SearchUpdateQueuedJobProcessor extends SearchUpdateBatchedProcessor implements QueuedJob (View source)

Traits

Provides extensions to this object to integrate it with standard config API methods.

Config options

batch_size int

Maximum number of record-states to process in one batch.

from  SearchUpdateBatchedProcessor
batch_soft_cap int

Up to this number of additional ids can be added to any batch in order to reduce the number of batches

from  SearchUpdateBatchedProcessor
reindex_queue string

The QueuedJob queue to use when processing updates

Properties

protected array $dirty

List of dirty records to process in format

from  SearchUpdateProcessor
protected array $batches

List of batches to be processed

from  SearchUpdateBatchedProcessor
protected int $currentBatch

Pointer to index of $batches assigned to $current.

from  SearchUpdateBatchedProcessor
protected array $completedIndexes

List of indexes successfully comitted in the current batch

from  SearchUpdateBatchedProcessor
protected $messages

Methods

public
__construct()

No description

public
addDirtyIDs($class, $statefulids, $index)

No description

protected
array
prepareIndexes()

Generates the list of indexes to process for the dirty items

protected
bool
commitIndex(SolrIndex $index)

Commits the specified index to the Solr service

protected
array
getSource()

Gets the record data source to process

public
bool
process()

Process the current queue

public
triggerProcessing()

No description

public static 
config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

public
mixed
stat(string $name) deprecated

Get inherited config value

public
mixed
uninherited(string $name)

Gets the uninherited value for the given config option

public
$this
set_stat(string $name, mixed $value) deprecated

Update the config value for a given property

protected
setBatch(int $batch)

Set the current batch index

protected
array
segmentBatches(array $source)

Segments batches acording to the specified rules

public
batchData()

No description

public
string
getTitle()

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

public
string
getSignature()

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

public
getJobType()

What type of job is this? Options are

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

public
jobFinished()

Returns true or false to indicate that this job is finished

public
setup()

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

public
prepareForRestart()

Called whenever a job is restarted for whatever reason.

public
afterComplete()

No description

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

Details

__construct()

No description

addDirtyIDs($class, $statefulids, $index)

No description

Parameters

$class
$statefulids
$index

protected array prepareIndexes()

Generates the list of indexes to process for the dirty items

Return Value

array

protected bool commitIndex(SolrIndex $index)

Commits the specified index to the Solr service

Parameters

SolrIndex $index

Index object

Return Value

bool

Flag indicating success

protected array getSource()

Gets the record data source to process

Return Value

array

bool process()

Process the current queue

Return Value

bool

Flag indicating success

triggerProcessing()

No description

static Config_ForClass config()

Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).

Return Value

Config_ForClass

mixed stat(string $name) deprecated

deprecated 5.0 Use ->config()->get() instead

Get inherited config value

Parameters

string $name

Return Value

mixed

mixed uninherited(string $name)

Gets the uninherited value for the given config option

Parameters

string $name

Return Value

mixed

$this set_stat(string $name, mixed $value) deprecated

deprecated 5.0 Use ->config()->set() instead

Update the config value for a given property

Parameters

string $name
mixed $value

Return Value

$this

protected setBatch(int $batch)

Set the current batch index

Parameters

int $batch

Index of the batch

protected array segmentBatches(array $source)

Segments batches acording to the specified rules

Parameters

array $source

Source input

Return Value

array Batches

batchData()

No description

string getTitle()

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

Return Value

string

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

getJobType()

What type of job is this? Options are

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

jobFinished()

Returns true or false to indicate that this job is finished

setup()

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

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

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