mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 11:21:16 +00:00
Handle HTTP 202 HEAD&GET with a retry (#791)
* Handle HTTP 202 Fixes #564 After some testing, it seems GitHub seems to be able to process the chrunching of statistics for every repository I tested in around 2 seconds. So a delay of around 5 seconds should be plenty to be very certain that the next try should succeed. Another option would be to put this value lower and possibly waste an extra retry on it. * Only re-request data if HEAD or GET (those are 'safe') to e.g. avoid running a duplicate POST or PUT, that can change stuff on the server Using RFC 2616 and https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html as guideline * Fix testStatistics * change wait time to 2 secs
This commit is contained in:
committed by
Wan Liuyang
parent
8bdac23ca1
commit
3aead15818
@@ -674,17 +674,7 @@ class Repository(Framework.TestCase):
|
||||
def testUnsubscribePubSubHubbub(self):
|
||||
self.repo.unsubscribe_from_hub("push", "http://requestb.in/1bc1sc61")
|
||||
|
||||
def testStatisticsBeforeCaching(self):
|
||||
self.assertEqual(self.repo.get_stats_contributors(), None)
|
||||
self.assertEqual(self.repo.get_stats_commit_activity(), None)
|
||||
self.assertEqual(self.repo.get_stats_code_frequency(), None)
|
||||
# ReplayData for those last two get_stats is forged because I was not
|
||||
# able to find a repo where participation and punch_card had never been
|
||||
# computed, and pushing to master did not reset the cache for them
|
||||
self.assertEqual(self.repo.get_stats_participation(), None)
|
||||
self.assertEqual(self.repo.get_stats_punch_card(), None)
|
||||
|
||||
def testStatisticsAfterCaching(self):
|
||||
def testStatistics(self):
|
||||
stats = self.repo.get_stats_contributors()
|
||||
seenJacquev6 = False
|
||||
for s in stats:
|
||||
|
||||
Reference in New Issue
Block a user