Skip to content

Commit

Permalink
fix(send_kcidb.py): Do not crash if findfast fails
Browse files Browse the repository at this point in the history
In some cases (broken nodes) we might crash on HTTP/4xx reply.
Do not crash, still process events.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
  • Loading branch information
nuclearcat committed Jan 28, 2025
1 parent 3634a56 commit 9d361ef
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/send_kcidb.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,12 +601,16 @@ def _find_unprocessed_node(self, chunksize):
if self._last_unprocessed_search and \
time.time() - self._last_unprocessed_search < 5 * 60:
return None
nodes = self._api.node.findfast({
'state': 'done',
'processed_by_kcidb_bridge': False,
'created__gt': datetime.datetime.now() - datetime.timedelta(days=4),
'limit': chunksize
})
try:
nodes = self._api.node.findfast({
'state': 'done',
'processed_by_kcidb_bridge': False,
'created__gt': datetime.datetime.now() - datetime.timedelta(days=4),
'limit': chunksize,
})
except Exception as exc:
self.log.error(f"Failed to find unprocessed nodes: {str(exc)}")
return []

if len(nodes) < chunksize:
self._last_unprocessed_search = time.time()
Expand Down

0 comments on commit 9d361ef

Please sign in to comment.