Code Duplication    Length = 13-16 lines in 2 locations

lib/Command/Live.php 1 location

@@ 232-244 (lines=13) @@
229
230
			$indexes = $this->indexService->getQueuedIndexes();
231
232
			foreach ($indexes as $index) {
233
				$this->runner->updateAction('indexing');
234
235
				try {
236
					$provider = $this->providerService->getProvider($index->getProviderId());
237
					$provider->setRunner($this->runner);
238
					$this->indexService->updateDocument($platform, $provider, $index);
239
				} catch (Exception $e) {
240
					$this->runner->exception($e->getMessage(), false);
241
					// TODO - upgrade error number - after too many errors, delete index
242
					// TODO - do not count error if elasticsearch is down.
243
				}
244
			}
245
246
			$this->runner->updateAction('waiting', true);
247

lib/Cron/Index.php 1 location

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