Code Duplication    Length = 15-17 lines in 2 locations

lib/Command/Live.php 1 location

@@ 283-297 (lines=15) @@
280
281
			$indexes = $this->indexService->getQueuedIndexes();
282
283
			foreach ($indexes as $index) {
284
				$this->runner->updateAction('indexing');
285
286
				try {
287
					$providerWrapper = $this->providerService->getProvider($index->getProviderId());
288
					$provider = $providerWrapper->getProvider();
289
290
					$provider->setRunner($this->runner);
291
					$this->indexService->updateDocument($platform, $provider, $index);
292
				} catch (Exception $e) {
293
					$this->runner->exception($e->getMessage(), false);
294
					// TODO - upgrade error number - after too many errors, delete index
295
					// TODO - do not count error if elasticsearch is down.
296
				}
297
			}
298
299
			$this->runner->updateAction('waiting', true);
300

lib/Cron/Index.php 1 location

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