From 6b813f56c9208743002456792009dd14b950b8d3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 18 Dec 2015 14:31:27 +0100 Subject: Do not delete background jobs, in case an exception occured This approach is not valid anymore. It initially was added for jobs of non existing apps. But jobs of non-existing apps can not be created so they will never be executed and so this call just catches other cases which were not intended. This reverts commit 4f4ad72460f8ef299cd1235b5774c5f121cca430. --- lib/private/backgroundjob/job.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/private/backgroundjob/job.php b/lib/private/backgroundjob/job.php index 88682cd09bb..40a27491fe6 100644 --- a/lib/private/backgroundjob/job.php +++ b/lib/private/backgroundjob/job.php @@ -54,7 +54,6 @@ abstract class Job implements IJob { if ($logger) { $logger->error('Error while running background job: ' . $e->getMessage()); } - $jobList->remove($this, $this->argument); } } -- cgit v1.2.3 From 54558bb5b296740233036601d2b3eb7f87ee48c4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 18 Dec 2015 15:05:32 +0100 Subject: Fix the test to expect the new behaviour --- tests/lib/backgroundjob/job.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/lib/backgroundjob/job.php b/tests/lib/backgroundjob/job.php index fec9b0a792d..912e0e13b57 100644 --- a/tests/lib/backgroundjob/job.php +++ b/tests/lib/backgroundjob/job.php @@ -23,10 +23,17 @@ class Job extends \Test\TestCase { }); $jobList->add($job); + $logger = $this->getMockBuilder('OCP\ILogger') + ->disableOriginalConstructor() + ->getMock(); + $logger->expects($this->once()) + ->method('error') + ->with('Error while running background job: '); + $this->assertCount(1, $jobList->getAll()); - $job->execute($jobList); + $job->execute($jobList, $logger); $this->assertTrue($this->run); - $this->assertCount(0, $jobList->getAll()); + $this->assertCount(1, $jobList->getAll()); } public function markRun() { -- cgit v1.2.3