aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2017-04-19 18:21:03 +0200
committerChristian Weiske <cweiske@cweiske.de>2017-04-19 18:21:03 +0200
commit8a4d28fa14e4b0053d5fb9753535124b6bcbfe5e (patch)
treec5edfc0804336e9cded34fc7e06e7dfd3f1a7f58 /src
parente345da5f229be52b35c613d894687328a34da71c (diff)
downloadphorkie-8a4d28fa14e4b0053d5fb9753535124b6bcbfe5e.tar.gz
phorkie-8a4d28fa14e4b0053d5fb9753535124b6bcbfe5e.zip
Silently ignore invalid (already deleted) pastes
ElasticSearch takes a bit to delete a paste, and we got exceptions when trying to list recent pastes when one of them had been deleted. Resolves: https://github.com/cweiske/phorkie/issues/25
Diffstat (limited to 'src')
-rw-r--r--src/phorkie/Database/Adapter/Elasticsearch/Search.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/phorkie/Database/Adapter/Elasticsearch/Search.php b/src/phorkie/Database/Adapter/Elasticsearch/Search.php
index ddbc13b..cc3941a 100644
--- a/src/phorkie/Database/Adapter/Elasticsearch/Search.php
+++ b/src/phorkie/Database/Adapter/Elasticsearch/Search.php
@@ -64,7 +64,11 @@ class Database_Adapter_Elasticsearch_Search implements Database_ISearch
foreach ($jRes->hits->hits as $hit) {
$r = new Repository();
- $r->loadById($hit->_source->id);
+ try {
+ $r->loadById($hit->_source->id);
+ } catch (Exception_NotFound $e) {
+ continue;
+ }
$r->crdate = strtotime($hit->_source->crdate);
$r->modate = strtotime($hit->_source->modate);
$sres->repos[] = $r;