Skip to content

Commit

Permalink
longer running cronjob - more sensible 5 minutes before stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
tgloeggl committed Aug 5, 2023
1 parent 538b93f commit 0fdcc68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cronjobs/opencast_worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ public function execute($last_result, $parameters = array())
{
$start_time = time();
// get next task and run it
// if a minute has already passed, stop executing tasks and finish the cronjob
// if 5 minutes have already passed, stop executing tasks and finish the cronjob

while ($start_time > (time() - 59)
while ($start_time > (time() - 299)
&& !empty($task = VideoSync::findOneBySQL("
scheduled <= NOW() AND state = 'scheduled'
ORDER BY scheduled ASC",
Expand Down
2 changes: 1 addition & 1 deletion migrations/050_scheduling_cronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function up()
// add the new cronjobs
if ($task_id) {
$scheduler->cancelByTask($task_id);
$scheduler->schedulePeriodic($task_id, -1); // negative value means "every x minutes"
$scheduler->schedulePeriodic($task_id, -5); // negative value means "every x minutes"
CronjobSchedule::findByTask_id($task_id)[0]->activate();
}

Expand Down

0 comments on commit 0fdcc68

Please sign in to comment.