-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rate limit error handling. #2
Conversation
continue | ||
} else if retryCount < 3 { | ||
log.Printf("Error during upload, sleeping for 10 seconds before retrying...") | ||
time.Sleep(10 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need this second else if
. I think we could change the for retry != false {
for something like:
for retry != false && retryCount < 3 {
and remove this code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to handle errors other than rate limit differently than other errors so I think this should still stay like this.
@pacoorozco I got this for the first time after making these changes. Could it be caused by anything I did in the last commit?
edit: yes it's this line
|
@pacoorozco Ah I remember now. You don't have access to the response if error is != nil. That's why I did it this way. |
Yes @nhorvath, you are absolutely right! I don't think Google's doing things easy to deal with errors, but your new code it's right.... Sorry for bother you :-D +1 |
Looks good to merge to me ! |
Add an accepted status on response
Gracefully handles rate limiting in the Photos API.
gphotosuploader/gphotos-uploader-cli#22