Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simple_cron
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
simple_cron
Commits
c5a80d41
Commit
c5a80d41
authored
4 months ago
by
Olivier Briat
Committed by
Scott Euser
4 months ago
Browse files
Options
Downloads
Patches
Plain Diff
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
!3
Issue #3383149: Simple cron log should not log non scheduled jobs.
Pipeline
#367566
passed
4 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Entity/CronJob.php
+6
-2
6 additions, 2 deletions
src/Entity/CronJob.php
tests/src/Unit/Entity/CronJobTest.php
+6
-1
6 additions, 1 deletion
tests/src/Unit/Entity/CronJobTest.php
with
12 additions
and
3 deletions
src/Entity/CronJob.php
+
6
−
2
View file @
c5a80d41
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
tests/src/Unit/Entity/CronJobTest.php
+
6
−
1
View file @
c5a80d41
...
...
@@ -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'
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment