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