Skip to content
Snippets Groups Projects
Commit c5a80d41 authored by Olivier Briat's avatar Olivier Briat Committed by Scott Euser
Browse files

Issue #3383149 by o'briat, scott_euser: Simple cron log should not log non scheduled jobs

parent 7f82b091
No related branches found
No related tags found
1 merge request!3Issue #3383149: Simple cron log should not log non scheduled jobs.
Pipeline #367566 passed
......@@ -323,8 +323,12 @@ class CronJob extends ConfigEntityBase implements CronJobInterface {
try {
$plugin = $this->getPlugin();
if (!$plugin || !$this->shouldRun($request_time, $force)) {
$this->logger->warning('Cron job @job should not be running.', ['@job' => $this->label()]);
if (!$plugin) {
$this->logger->warning('Cron job @job could not be run: missing plugin.', ['@job' => $this->label()]);
return FALSE;
}
if (!$this->shouldRun($request_time, $force)) {
// Do nothing: this job is not scheduled to be run at this time.
return FALSE;
}
......
......@@ -128,7 +128,12 @@ class CronJobTest extends UnitTestCase {
$this->assertEquals($expected, $last_run_time_is_set, 'Last run time is correct.');
$this->assertEquals($expected, $status, 'Cron run is executed.');
$this->assertEquals(!$locked, $this->state->get('state.message_logged'), 'Message is logged');
if (!$locked && !$should_run) {
$this->assertEquals($locked, $this->state->get('state.message_logged'), 'Message is logged');
}
else {
$this->assertEquals(!$locked, $this->state->get('state.message_logged'), 'Message is logged');
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment