Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2017-04-27 17:45:13 +0300
committerMorris Jobke <hey@morrisjobke.de>2017-04-29 05:41:38 +0300
commit7340d6a56c1b4becb75da41b33239357efc530a5 (patch)
tree7046ec7678797050029afc7b7bd92831bacf9c46 /apps/lookup_server_connector
parent4ec05ef0507d840f18bebc7750b05e31a67bc21b (diff)
don't add multiple retry jobs
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r--apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php34
1 files changed, 21 insertions, 13 deletions
diff --git a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
index f33323b2d4f..faeef05da17 100644
--- a/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
+++ b/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php
@@ -26,6 +26,7 @@ namespace OCA\LookupServerConnector\BackgroundJobs;
use OC\BackgroundJob\Job;
use OCP\BackgroundJob\IJobList;
use OCP\Http\Client\IClientService;
+use OCP\ILogger;
class RetryJob extends Job {
/** @var IClientService */
@@ -36,21 +37,28 @@ class RetryJob extends Job {
private $lookupServer = 'https://lookup.nextcloud.com/users';
/**
- * @param IClientService|null $clientService
- * @param IJobList|null $jobList
+ * @param IClientService $clientService
+ * @param IJobList $jobList
*/
- public function __construct(IClientService $clientService = null,
- IJobList $jobList = null) {
- if($clientService !== null) {
- $this->clientService = $clientService;
- } else {
- $this->clientService = \OC::$server->getHTTPClientService();
- }
- if($jobList !== null) {
- $this->jobList = $jobList;
- } else {
- $this->jobList = \OC::$server->getJobList();
+ public function __construct(IClientService $clientService,
+ IJobList $jobList) {
+ $this->clientService = $clientService;
+ $this->jobList = $jobList;
+ }
+
+ /**
+ * run the job, then remove it from the jobList
+ *
+ * @param JobList $jobList
+ * @param ILogger $logger
+ */
+ public function execute($jobList, ILogger $logger = null) {
+
+ if ($this->shouldRun($this->argument)) {
+ parent::execute($jobList, $logger);
+ $jobList->remove($this, $this->argument);
}
+
}
protected function run($argument) {