Code Duplication    Length = 15-17 lines in 2 locations

lib/Cron/Index.php 1 location

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

lib/Command/Live.php 1 location

@@ 266-280 (lines=15) @@
263
264
			$indexes = $this->indexService->getQueuedIndexes();
265
266
			foreach ($indexes as $index) {
267
				$this->runner->updateAction('indexing');
268
269
				try {
270
					$providerWrapper = $this->providerService->getProvider($index->getProviderId());
271
					$provider = $providerWrapper->getProvider();
272
273
					$provider->setRunner($this->runner);
274
					$this->indexService->updateDocument($platform, $provider, $index);
275
				} catch (Exception $e) {
276
					$this->runner->exception($e->getMessage(), false);
277
					// TODO - upgrade error number - after too many errors, delete index
278
					// TODO - do not count error if elasticsearch is down.
279
				}
280
			}
281
282
			$this->runner->updateAction('waiting', true);
283