Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #537 from openshift/Ximinhan-check-ratelimit
Browse files Browse the repository at this point in the history
check ratelimit
  • Loading branch information
Ximinhan committed Nov 24, 2021
2 parents 170f4a5 + ea01a16 commit eeb3362
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions doozerlib/cli/images_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json
import hashlib
import time
import datetime
import random

from github import Github, UnknownObjectException, GithubException
Expand Down Expand Up @@ -573,6 +574,9 @@ def images_upstreampulls(runtime):
if public_repo_url in upstreams:
continue
upstreams.add(public_repo_url)
rateLimit = github_client.get_rate_limit()
if rateLimit.core.remaining < 1000:
time.sleep((rateLimit.core.reset - datetime.datetime.now()).seconds)
public_source_repo = github_client.get_repo(f'{org}/{repo_name}')
pulls = public_source_repo.get_pulls(state='open', sort='created')
for pr in pulls:
Expand Down

0 comments on commit eeb3362

Please sign in to comment.