GitHub: handle edge cases with empty responses
This commit is contained in:
parent
c375a61b16
commit
879170a57d
1 changed files with 9 additions and 0 deletions
|
@ -306,6 +306,10 @@ class GitHubLister(Lister[GitHubListerState, List[Dict[str, Any]]]):
|
|||
assert self.lister_obj.id is not None
|
||||
|
||||
for repo in page:
|
||||
if not repo:
|
||||
# null repositories in listings happen sometimes...
|
||||
continue
|
||||
|
||||
pushed_at_str = repo.get("pushed_at")
|
||||
pushed_at: Optional[datetime.datetime] = None
|
||||
if pushed_at_str:
|
||||
|
@ -324,6 +328,11 @@ class GitHubLister(Lister[GitHubListerState, List[Dict[str, Any]]]):
|
|||
# Don't update internal state when relisting
|
||||
return
|
||||
|
||||
if not page:
|
||||
# Sometimes, when you reach the end of the world, GitHub returns an empty
|
||||
# page of repositories
|
||||
return
|
||||
|
||||
last_id = page[-1]["id"]
|
||||
|
||||
if last_id > self.state.last_seen_id:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue