Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
WP Plugins
Cron-Control
Commits
b867174b
Verified
Commit
b867174b
authored
Dec 13, 2016
by
Erick Hitter
Browse files
Prepare for queue contents to be manipulated ot keep one job from occupying all positions
parent
e5b78d64
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/class-events.php
View file @
b867174b
...
...
@@ -89,7 +89,7 @@ class Events extends Singleton {
// Limit batch size to avoid resource exhaustion
if
(
count
(
$current_events
)
>
JOB_QUEUE_SIZE
)
{
$current_events
=
array_slice
(
$current_events
,
0
,
JOB_QUEUE_SIZE
);
$current_events
=
$this
->
reduce_queue
(
$current_events
);
}
return
array
(
...
...
@@ -331,6 +331,19 @@ class Events extends Singleton {
return
false
;
}
/**
* Trim events queue down to the limit set by JOB_QUEUE_SIZE
*
* @param $events array List of events to be run in the current period
*
* @return array
*/
private
function
reduce_queue
(
$events
)
{
$reduced_queue
=
array_slice
(
$events
,
0
,
JOB_QUEUE_SIZE
);
return
$reduced_queue
;
}
}
Events
::
instance
();
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment