#125 Add catch for github api limit
Merged by sidpremkumar. Opened by sidpremkumar.
sidpremkumar/sync-to-jira catch-github-limit-api  into  develop

Download 125.patch

Add catch for github api limit. If we've found it:
1 - Sleep for 1 hour
2 - Call the initialize function again
3 - Return as normal

The exception e kept returning as an OSError instead of a github API error. That is why I had to use e.__str___() instead of comparing the type of exception directly.

Probably not supposed to be here? Is it not handled by the log.debug line?

You may want a block here that does:

else:
    raise

So that you re-raise the exception just exactly as it was in the case that "API rate limit ..." is not in the exception string.

Probably not supposed to be here? Is it not handled by the log.debug line?

Yup this was used to test locally. I'll change it.

You may want a block here that does:
else:
raise

So that you re-raise the exception just exactly as it was in the case that "API rate limit ..." is not in the exception string.

Ah thats a good idea! Might also make sense to report_failure as well if its not a Github error.

rebased onto e34a0f3605b6cf0d70fa9d0a0e6d7ef0c783ffb8

TODO for myself:
- Update the tests to capture this possibility.

rebased onto 8cfe50bc05c4f9d3718a44ede28c2ade0fa13152

rebased onto 1c8826bf242aff97fc3ad5ab376f9446b68e1618

@ralph this is ready for a final review.

Added a testing flag so when we test the function we don't get caught in a recursive loop

rebased onto be7063d53cb3a139c26c2c585d888781cf75ab10

Pull-Request has been merged by sidpremkumar

Metadata