Skip to content

Commit

Permalink
Move actual rebuild into cron hook for better scalability.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Barth committed Oct 19, 2010
1 parent ff908c9 commit 4080017
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions job_scheduler.module
Expand Up @@ -34,6 +34,15 @@ function job_scheduler_info($name = NULL) {
* Implementation of hook_cron().
*/
function job_scheduler_cron() {
// Reschedule all jobs if requested.
if (variable_get('job_scheduler_rebuild_all', FALSE)) {
foreach (job_scheduler_info() as $name => $info) {
job_scheduler_rebuild_scheduler($name, $info);
}
variable_set('job_scheduler_rebuild_all', FALSE);
return;
}

// Reschedule stuck periodic jobs after one hour.
db_update('job_schedule')
->fields(array(
Expand Down Expand Up @@ -95,9 +104,7 @@ function job_scheduler_modules_disabled($modules) {
* @todo What should we do about missing ones when disabling their module?
*/
function job_scheduler_rebuild_all() {
foreach (job_scheduler_info() as $name => $info) {
job_scheduler_rebuild_scheduler($name, $info);
}
variable_set('job_scheduler_rebuild_all', TRUE);
}

/**
Expand Down

0 comments on commit 4080017

Please sign in to comment.