Code Duplication    Length = 15-17 lines in 2 locations

lib/Cron/Index.php 1 location

@@ 123-139 (lines=17) @@
120
		$all = $this->shouldWeGetAllIndex();
121
		$indexes = $this->indexService->getQueuedIndexes($all);
122
123
		foreach ($indexes as $index) {
124
			$this->runner->updateAction('indexing');
125
126
			try {
127
				$providerWrapper = $this->providerService->getProvider($index->getProviderId());
128
				$provider = $providerWrapper->getProvider();
129
				if (!$this->providerService->isProviderIndexed($provider->getId())) {
130
					continue;
131
				}
132
133
				$this->indexService->updateDocument($platform, $provider, $index);
134
			} catch (Exception $e) {
135
				$this->runner->exception($e->getMessage(), false);
136
				// TODO - upgrade error number - after too many errors, delete index
137
				// TODO - do not count error if elasticsearch is down.
138
			}
139
		}
140
141
	}
142

lib/Command/Live.php 1 location

@@ 304-318 (lines=15) @@
301
302
			$indexes = $this->indexService->getQueuedIndexes();
303
304
			foreach ($indexes as $index) {
305
				$this->runner->updateAction('indexing');
306
307
				try {
308
					$providerWrapper = $this->providerService->getProvider($index->getProviderId());
309
					$provider = $providerWrapper->getProvider();
310
311
					$provider->setRunner($this->runner);
312
					$this->indexService->updateDocument($platform, $provider, $index);
313
				} catch (Exception $e) {
314
					$this->runner->exception($e->getMessage(), false);
315
					// TODO - upgrade error number - after too many errors, delete index
316
					// TODO - do not count error if elasticsearch is down.
317
				}
318
			}
319
320
			$this->runner->updateAction('waiting', true);
321