Skip to content
This repository has been archived by the owner on Sep 17, 2018. It is now read-only.

Commit

Permalink
Support for handling the lag in Github's API update on large commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
tav committed Jan 27, 2009
1 parent 6f88db7 commit 4f2c203
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions gitbot.py
Expand Up @@ -253,9 +253,24 @@ def check_github_and_update(gitbot, with_url=WITH_URL, with_files=WITH_FILES):

shortcommit = commit_id[:8]

commit_data = simplejson.loads(urlopen(
'http://github.com/api/v1/json/%s/%s/commit/%s' % (user, reponame, commit_id)
).read())['commit']
failed = True
retry = 3

while retry:
try:
commit_data = simplejson.loads(urlopen(
'http://github.com/api/v1/json/%s/%s/commit/%s' % (user, reponame, commit_id)
).read())['commit']
except:
retry = retry - 1
time.sleep(2)
else:
retry = 0
failed = False

if failed:
seen.remove(commit_id)
continue

author = commit_data['committer']['name']
added = [split_path(file['filename']) for file in commit_data['added']]
Expand Down

0 comments on commit 4f2c203

Please sign in to comment.