[FIX] *: better cope with secondary rate limits

* the repository apparently takes a lot more time to
  propagate (randomly) now, so wait until we can *see* it
* also add sleep after modification operations on the new repository

Ideally this should be done a lot more ubiquitously, but for now this
seems to more or less suffice.
This commit is contained in:
Xavier Morel 2021-11-16 13:57:32 +01:00
parent 08c4e94ca9
commit 3cdcba2f26

View File

@ -403,6 +403,13 @@ def make_repo(capsys, request, config, tunnel, users):
# 'allow_merge_commit': False,
'allow_rebase_merge': False,
}))
r = r.json()
# wait for repository visibility
while True:
time.sleep(1)
if github.head(r['url']).ok:
break
repo = Repo(github, fullname, repos)
# create webhook
@ -415,6 +422,7 @@ def make_repo(capsys, request, config, tunnel, users):
},
'events': ['pull_request', 'issue_comment', 'status', 'pull_request_review']
}))
time.sleep(1)
check(github.put('{}/contents/{}'.format(repo_url, 'a'), json={
'path': 'a',
@ -422,8 +430,7 @@ def make_repo(capsys, request, config, tunnel, users):
'content': base64.b64encode(b'whee').decode('ascii'),
'branch': 'garbage_%s' % uuid.uuid4()
}))
# try to unwatch repo, doesn't actually work
repo.unsubscribe()
time.sleep(1)
return repo
yield repomaker