Code Duplication    Length = 13-16 lines in 2 locations

lib/Command/Live.php 1 location

@@ 143-155 (lines=13) @@
140
141
			$indexes = $this->indexService->getQueuedIndexes();
142
143
			foreach ($indexes as $index) {
144
				$this->runner->update('indexing');
145
146
				try {
147
					$provider = $this->providerService->getProvider($index->getProviderId());
148
					$provider->setRunner($this->runner);
149
					$this->indexService->updateDocument($platform, $provider, $index);
150
				} catch (Exception $e) {
151
					$this->runner->exception($e->getMessage(), false);
152
					// TODO - upgrade error number - after too many errors, delete index
153
					// TODO - do not count error if elasticsearch is down.
154
				}
155
			}
156
157
			$this->runner->update('waiting');
158

lib/Cron/Index.php 1 location

@@ 107-122 (lines=16) @@
104
		$platform = $this->platformService->getPlatform(true);
105
		$indexes = $this->indexService->getQueuedIndexes();
106
107
		foreach ($indexes as $index) {
108
			$this->runner->update('indexing');
109
110
			try {
111
				$provider = $this->providerService->getProvider($index->getProviderId());
112
				if (!$this->providerService->isProviderIndexed($provider->getId())) {
113
					continue;
114
				}
115
116
				$this->indexService->updateDocument($platform, $provider, $index);
117
			} catch (Exception $e) {
118
				$this->runner->exception($e->getMessage(), false);
119
				// TODO - upgrade error number - after too many errors, delete index
120
				// TODO - do not count error if elasticsearch is down.
121
			}
122
		}
123
124
125
	}