src-d / ghsync

GitHub API v3 > PostgreSQL
https://sourced.tech
GNU General Public License v3.0
9 stars 8 forks source link

Add github api retries #45

Closed carlosms closed 5 years ago

carlosms commented 5 years ago

Part of #37.

The logs will look like this:

[2019-06-20T12:58:34.236908691+01:00]  INFO The DB was upgraded
[2019-06-20T12:58:35.032506058+01:00]  INFO connection with the DB established
[2019-06-20T12:58:35.034241516+01:00] ERROR retrying in 10ms error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:35.045928805+01:00] ERROR retrying in 20ms error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:35.06757551+01:00] ERROR retrying in 60ms error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:35.129441857+01:00] ERROR retrying in 300ms error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:35.431817809+01:00] ERROR retrying in 2.7s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:38.134222928+01:00] ERROR retrying in 10s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:48.137069102+01:00] ERROR retrying in 10s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:58:58.139183198+01:00] ERROR retrying in 10s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:59:08.141450129+01:00] ERROR retrying in 10s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
[2019-06-20T12:59:18.14380071+01:00] ERROR retrying in 10s error=Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host organization=carlosms-test-org
Get https://api.github.com/orgs/carlosms-test-org: dial tcp: lookup api.github.com: no such host
exit status 1
carlosms commented 5 years ago

Changed to be a RoundTripper in d7b18c5. I left the previous code + revert for the review, will squash before merging.