Job for updating translation memory. More...
Public Member Functions | |
__construct ( $title, $params=[]) | |
run () | |
Fetch all the translations and update them. | |
allowRetries () | |
@inheritDoc | |
setDelay ( $delay) | |
Set a delay for this job. | |
Static Public Member Functions | |
static | newJob (MessageHandle $handle, $command) |
static | backoffDelay ( $errorCount) |
Protected Member Functions | |
resend (self $job) | |
Extracted for testing purpose. | |
getHandle () | |
Extracted for testing purpose. | |
getTranslation (MessageHandle $handle) | |
Extracted for testing purpose. | |
Protected Attributes | |
const | MAX_ERROR_RETRY = 4 |
Number of retries allowed, 4 means we attempt to run the job 5 times (1 initial attempt + 4 retries). | |
const | WRITE_BACKOFF_EXPONENT = 7 |
Constant used by backoffDelay(). | |
Job for updating translation memory.
job params:
This job handles retries itself and return false in allowRetries to disable JobQueue's internal retry service.
If mirroring is activated on the primary service then the first job will try to write to all services, it will resend a new job to every single service that failed and will increment errorCount. When too many errors occur on single service the job is dropped.
Definition at line 37 of file TTMServerMessageUpdateJob.php.
TTMServerMessageUpdateJob::__construct | ( | $title, | |
$params = [] ) |
Title | $title | |
array | $params |
Definition at line 70 of file TTMServerMessageUpdateJob.php.
TTMServerMessageUpdateJob::allowRetries | ( | ) |
@inheritDoc
Definition at line 98 of file TTMServerMessageUpdateJob.php.
|
static |
int | $errorCount | The number of times the job has errored out. |
Definition at line 290 of file TTMServerMessageUpdateJob.php.
|
protected |
Extracted for testing purpose.
Definition at line 193 of file TTMServerMessageUpdateJob.php.
|
protected |
Extracted for testing purpose.
MessageHandle | $handle |
Definition at line 203 of file TTMServerMessageUpdateJob.php.
|
static |
MessageHandle | $handle | |
string | $command |
Definition at line 60 of file TTMServerMessageUpdateJob.php.
|
protected |
Extracted for testing purpose.
self | $job |
Definition at line 162 of file TTMServerMessageUpdateJob.php.
TTMServerMessageUpdateJob::run | ( | ) |
Fetch all the translations and update them.
Definition at line 89 of file TTMServerMessageUpdateJob.php.
TTMServerMessageUpdateJob::setDelay | ( | $delay | ) |
Set a delay for this job.
Note that this might not be possible, the JobQueue implementation handling this job doesn't support it (JobQueueDB) but is possible for the high performance JobQueueRedis. Note also that delays are minimums - at least JobQueueRedis makes no effort to remove the delay as soon as possible after it has expired. By default it only checks every five minutes or so. Note yet again that if another delay has been set that is longer then this one then the longer delay stays.
int | $delay | seconds to delay this job if possible |
Definition at line 271 of file TTMServerMessageUpdateJob.php.
|
protected |
Number of retries allowed, 4 means we attempt to run the job 5 times (1 initial attempt + 4 retries).
Definition at line 42 of file TTMServerMessageUpdateJob.php.
|
protected |
Constant used by backoffDelay().
With 7 the cumulative delay between the first and last attempt is between 8 and 33 minutes.
Definition at line 49 of file TTMServerMessageUpdateJob.php.