From eba1b5816b1ddcf9cb2857bea9a5cfea3abe1247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Due=C3=B1as?= Date: Fri, 24 Oct 2025 12:26:39 +0200 Subject: [PATCH] [eclipse] Fix pagination error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pagination wasn't done right. The backend did not use the right parameters to check when it have reached the last page of accounts. Signed-off-by: Santiago Dueñas --- releases/unreleased/pagination-error-fixed.yml | 9 +++++++++ sortinghat/core/importer/backends/eclipse.py | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 releases/unreleased/pagination-error-fixed.yml diff --git a/releases/unreleased/pagination-error-fixed.yml b/releases/unreleased/pagination-error-fixed.yml new file mode 100644 index 0000000..eedbd20 --- /dev/null +++ b/releases/unreleased/pagination-error-fixed.yml @@ -0,0 +1,9 @@ +--- +title: Pagination error fixed +category: fixed +author: Santiago Dueñas +issue: null +notes: > + Pagination wasn't done right. The backend did not + use the right parameters to check when it have + reached the last page of accounts. diff --git a/sortinghat/core/importer/backends/eclipse.py b/sortinghat/core/importer/backends/eclipse.py index 7b7770a..6f6c9c4 100644 --- a/sortinghat/core/importer/backends/eclipse.py +++ b/sortinghat/core/importer/backends/eclipse.py @@ -247,7 +247,8 @@ def fetch_accounts(self, epoch): url = f"{self.ECLIPSE_ACCOUNTS_URL}/account/updated" params = { 'since': epoch, - 'page': page + 'page': page, + 'pagesize': 100, } logger.debug(f"Fetching accounts from API; url={url}, params={params}") @@ -259,9 +260,9 @@ def fetch_accounts(self, epoch): naccounts = len(data['result']) total_accounts += naccounts - logger.debug(f"Accounts from API fetched; url={url}, params={params}, naccounts={naccounts}") + logger.info(f"Accounts from API fetched; url={url}, params={params}, naccounts={naccounts}") - if page >= data['pagination']['result_end']: + if data['pagination']['result_size'] == 0: break page += 1