From 6eaa77405189364e5c0557aa3b5e84dfbe5e2b14 Mon Sep 17 00:00:00 2001 From: Chris Weaver <25087905+Weves@users.noreply.github.com> Date: Fri, 11 Apr 2025 13:06:27 -0700 Subject: [PATCH] Confluence timeout fix? (#4509) --- backend/onyx/connectors/confluence/onyx_confluence.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/backend/onyx/connectors/confluence/onyx_confluence.py b/backend/onyx/connectors/confluence/onyx_confluence.py index ab8fc97bc..9e7cbc34c 100644 --- a/backend/onyx/connectors/confluence/onyx_confluence.py +++ b/backend/onyx/connectors/confluence/onyx_confluence.py @@ -488,6 +488,16 @@ class OnyxConfluence: old_url_suffix = url_suffix url_suffix = cast(str, next_response.get("_links", {}).get("next", "")) + # we've observed that Confluence sometimes returns a next link despite giving + # 0 results. This is a bug with Confluence, so we need to check for it and + # stop paginating. + if url_suffix and not results: + logger.info( + f"No results found for call '{old_url_suffix}' despite next link " + "being present. Stopping pagination." + ) + break + # make sure we don't update the start by more than the amount # of results we were able to retrieve. The Confluence API has a # weird behavior where if you pass in a limit that is too large for