mirror of
https://github.com/nextcloud/server.git
synced 2024-08-27 05:55:24 +02:00
don't add multiple retry jobs
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
parent
4ec05ef050
commit
7340d6a56c
@ -26,6 +26,7 @@ namespace OCA\LookupServerConnector\BackgroundJobs;
|
|||||||
use OC\BackgroundJob\Job;
|
use OC\BackgroundJob\Job;
|
||||||
use OCP\BackgroundJob\IJobList;
|
use OCP\BackgroundJob\IJobList;
|
||||||
use OCP\Http\Client\IClientService;
|
use OCP\Http\Client\IClientService;
|
||||||
|
use OCP\ILogger;
|
||||||
|
|
||||||
class RetryJob extends Job {
|
class RetryJob extends Job {
|
||||||
/** @var IClientService */
|
/** @var IClientService */
|
||||||
@ -36,21 +37,28 @@ class RetryJob extends Job {
|
|||||||
private $lookupServer = 'https://lookup.nextcloud.com/users';
|
private $lookupServer = 'https://lookup.nextcloud.com/users';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IClientService|null $clientService
|
* @param IClientService $clientService
|
||||||
* @param IJobList|null $jobList
|
* @param IJobList $jobList
|
||||||
*/
|
*/
|
||||||
public function __construct(IClientService $clientService = null,
|
public function __construct(IClientService $clientService,
|
||||||
IJobList $jobList = null) {
|
IJobList $jobList) {
|
||||||
if($clientService !== null) {
|
$this->clientService = $clientService;
|
||||||
$this->clientService = $clientService;
|
$this->jobList = $jobList;
|
||||||
} else {
|
}
|
||||||
$this->clientService = \OC::$server->getHTTPClientService();
|
|
||||||
}
|
/**
|
||||||
if($jobList !== null) {
|
* run the job, then remove it from the jobList
|
||||||
$this->jobList = $jobList;
|
*
|
||||||
} else {
|
* @param JobList $jobList
|
||||||
$this->jobList = \OC::$server->getJobList();
|
* @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) {
|
protected function run($argument) {
|
||||||
|
Loading…
Reference in New Issue
Block a user