Page MenuHomePhabricator

Pushing a job type not listed in $wgJobClasses should result in error
Open, Needs TriagePublic

Description

JobQueueGroup::push claims that $wgJobClasses is somehow involved in pushing but that doesn't seem to be the case: the job type is read via $job->command and it doesn't get double-checked against $wgJobClasses. Running jobs on the other hand relies on $wgJobClasses; job types not included in it are never scheduled to run. This leads to the following gotcha:

$wgJobClasses['myJob'] = MyJob::class;
class MyJob extends Job {
    public function __construct( $title, $params ) {
        parent::__construct( 'myJobWithATypo', $params );
    }
    public function run() {
        return true;
    }
}

This job will be scheduled without any kind of error or warning, but it will never be executed, nor shown in showJobs.php (which also relies on $wgJobClasses). Figuring out what happens can be very hard, given the job queue's convoluted code.

Event Timeline

Such a check can (only) be done trivially if the job queue that is being pushed into belongs to the same wiki.