Skip to content

Commit 54481c9

Browse files
authored
Merges #8 Closes #8
2 parents 79e6efe + eba1b58 commit 54481c9

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Pagination error fixed
3+
category: fixed
4+
author: Santiago Dueñas <sduenas@bitergia.com>
5+
issue: null
6+
notes: >
7+
Pagination wasn't done right. The backend did not
8+
use the right parameters to check when it have
9+
reached the last page of accounts.

sortinghat/core/importer/backends/eclipse.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def fetch_accounts(self, epoch):
247247
url = f"{self.ECLIPSE_ACCOUNTS_URL}/account/updated"
248248
params = {
249249
'since': epoch,
250-
'page': page
250+
'page': page,
251+
'pagesize': 100,
251252
}
252253

253254
logger.debug(f"Fetching accounts from API; url={url}, params={params}")
@@ -259,9 +260,9 @@ def fetch_accounts(self, epoch):
259260
naccounts = len(data['result'])
260261
total_accounts += naccounts
261262

262-
logger.debug(f"Accounts from API fetched; url={url}, params={params}, naccounts={naccounts}")
263+
logger.info(f"Accounts from API fetched; url={url}, params={params}, naccounts={naccounts}")
263264

264-
if page >= data['pagination']['result_end']:
265+
if data['pagination']['result_size'] == 0:
265266
break
266267

267268
page += 1

0 commit comments

Comments
 (0)