Code Duplication    Length = 13-16 lines in 2 locations

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

lib/Command/Live.php 1 location

@@ 254-266 (lines=13) @@
251
252
			$indexes = $this->indexService->getQueuedIndexes();
253
254
			foreach ($indexes as $index) {
255
				$this->runner->updateAction('indexing');
256
257
				try {
258
					$provider = $this->providerService->getProvider($index->getProviderId());
259
					$provider->setRunner($this->runner);
260
					$this->indexService->updateDocument($platform, $provider, $index);
261
				} catch (Exception $e) {
262
					$this->runner->exception($e->getMessage(), false);
263
					// TODO - upgrade error number - after too many errors, delete index
264
					// TODO - do not count error if elasticsearch is down.
265
				}
266
			}
267
268
			$this->runner->updateAction('waiting', true);
269