Sfoglia il codice sorgente

fix: Call execute until it is removed for Job class

Because if an application extends execute it will change behavior
 without warning otherwise.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v29.0.0beta2
Côme Chilliet 3 mesi fa
parent
commit
75751d51de
Nessun account collegato all'indirizzo email del committer
2 ha cambiato i file con 6 aggiunte e 3 eliminazioni
  1. 2
    1
      core/Command/Background/Job.php
  2. 4
    2
      cron.php

+ 2
- 1
core/Command/Background/Job.php Vedi File

$output->writeln('<error>Something went wrong when trying to retrieve Job with ID ' . $jobId . ' from database</error>'); $output->writeln('<error>Something went wrong when trying to retrieve Job with ID ' . $jobId . ' from database</error>');
return 1; return 1;
} }
$job->start($this->jobList);
/** Calling execute until it is removed, then will switch to start */
$job->execute($this->jobList);
$job = $this->jobList->getById($jobId); $job = $this->jobList->getById($jobId);


if (($job === null) || ($lastRun !== $job->getLastRun())) { if (($job === null) || ($lastRun !== $job->getLastRun())) {

+ 4
- 2
cron.php Vedi File

$memoryBefore = memory_get_usage(); $memoryBefore = memory_get_usage();
$memoryPeakBefore = memory_get_peak_usage(); $memoryPeakBefore = memory_get_peak_usage();


$job->start($jobList);
/** Calling execute until it is removed, then will switch to start */
$job->execute($jobList);


$memoryAfter = memory_get_usage(); $memoryAfter = memory_get_usage();
$memoryPeakAfter = memory_get_peak_usage(); $memoryPeakAfter = memory_get_peak_usage();
$job = $jobList->getNext(); $job = $jobList->getNext();
if ($job != null) { if ($job != null) {
$logger->debug('WebCron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']); $logger->debug('WebCron call has selected job with ID ' . strval($job->getId()), ['app' => 'cron']);
$job->start($jobList);
/** Calling execute until it is removed, then will switch to start */
$job->execute($jobList);
$jobList->setLastJob($job); $jobList->setLastJob($job);
} }
OC_JSON::success(); OC_JSON::success();

Loading…
Annulla
Salva