diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 10:02:52 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-29 10:02:52 +0100 |
commit | 24908a439a8b17929af57f122bc931e4deaefd01 (patch) | |
tree | 7e40bf7f3f77be959f71fb24b74e51e1626b4248 /lib | |
parent | 4070657875f0d98abf15f3fdcb50a173e9e087ce (diff) | |
parent | c83b3d6a264e4fccda13278b9dd9c02c4e819887 (diff) | |
download | nextcloud-server-24908a439a8b17929af57f122bc931e4deaefd01.tar.gz nextcloud-server-24908a439a8b17929af57f122bc931e4deaefd01.zip |
Merge pull request #21987 from owncloud/issue-21980-too-many-job-send-mysql-away
Do not create a loop that generates thousands of jobs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/backgroundjob/joblist.php | 2 | ||||
-rw-r--r-- | lib/public/backgroundjob.php | 38 | ||||
-rw-r--r-- | lib/public/backgroundjob/ijoblist.php | 2 |
3 files changed, 7 insertions, 35 deletions
diff --git a/lib/private/backgroundjob/joblist.php b/lib/private/backgroundjob/joblist.php index cc9be574807..2920cb5214c 100644 --- a/lib/private/backgroundjob/joblist.php +++ b/lib/private/backgroundjob/joblist.php @@ -139,6 +139,8 @@ class JobList implements IJobList { * get all jobs in the list * * @return IJob[] + * @deprecated 9.0.0 - This method is dangerous since it can cause load and + * memory problems when creating too many instances. */ public function getAll() { $query = $this->connection->getQueryBuilder(); diff --git a/lib/public/backgroundjob.php b/lib/public/backgroundjob.php index c8acb7e538b..cc76506758b 100644 --- a/lib/public/backgroundjob.php +++ b/lib/public/backgroundjob.php @@ -34,7 +34,6 @@ // This means that they should be used by apps instead of the internal ownCloud classes namespace OCP; -use \OC\BackgroundJob\JobList; /** * This class provides functions to register backgroundjobs in ownCloud @@ -115,16 +114,7 @@ class BackgroundJob { * @since 4.5.0 */ static public function allRegularTasks() { - $jobList = \OC::$server->getJobList(); - $allJobs = $jobList->getAll(); - $regularJobs = array(); - foreach ($allJobs as $job) { - if ($job instanceof RegularLegacyJob) { - $key = implode('-', $job->getArgument()); - $regularJobs[$key] = $job->getArgument(); - } - } - return $regularJobs; + return []; } /** @@ -146,17 +136,7 @@ class BackgroundJob { * @since 4.5.0 */ public static function allQueuedTasks() { - $jobList = \OC::$server->getJobList(); - $allJobs = $jobList->getAll(); - $queuedJobs = array(); - foreach ($allJobs as $job) { - if ($job instanceof QueuedLegacyJob) { - $queuedJob = $job->getArgument(); - $queuedJob['id'] = $job->getId(); - $queuedJobs[] = $queuedJob; - } - } - return $queuedJobs; + return []; } /** @@ -167,19 +147,7 @@ class BackgroundJob { * @since 4.5.0 */ public static function queuedTaskWhereAppIs($app) { - $jobList = \OC::$server->getJobList(); - $allJobs = $jobList->getAll(); - $queuedJobs = array(); - foreach ($allJobs as $job) { - if ($job instanceof QueuedLegacyJob) { - $queuedJob = $job->getArgument(); - $queuedJob['id'] = $job->getId(); - if ($queuedJob['app'] === $app) { - $queuedJobs[] = $queuedJob; - } - } - } - return $queuedJobs; + return []; } /** diff --git a/lib/public/backgroundjob/ijoblist.php b/lib/public/backgroundjob/ijoblist.php index 13775457edd..5a76ce1ba26 100644 --- a/lib/public/backgroundjob/ijoblist.php +++ b/lib/public/backgroundjob/ijoblist.php @@ -64,6 +64,8 @@ interface IJobList { * * @return \OCP\BackgroundJob\IJob[] * @since 7.0.0 + * @deprecated 9.0.0 - This method is dangerous since it can cause load and + * memory problems when creating too many instances. */ public function getAll(); |