Skip to content
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

make HTTP retry when the GoPro is overwhelmed #128

Merged
merged 2 commits into from
Sep 7, 2024

Conversation

klaernie
Copy link
Contributor

@klaernie klaernie commented Feb 8, 2024

replace net.http with go-retryablehttp

My HERO12 did not like being asked for more than about 5-7 files simultaneously. Instead it dropped some of the /gp/gpMediaMetadata requests with a timeout. So after the files where the call to gpMediaMetadata was successful were downloaded, I got presented with a bunch of errors where it didn't work, and of cause those files were not downloaded.

Switching to a retrying approach means that we still hammer the GoPro for the first couple seconds, but allow the requests to proceed later.

Since go-retryablehttp allows it, I set it up to retry with a lot of jitter, so the camera should not get hit with multiple requests at the same time anymore. I also went for the approach that does not require touching all the points where the pkg/utils/client is used, but instead slipped retryablehttp underneath the Client that already was used in all other places.

Please note, as with my other PRs - I'm a beginner at working with golang, and fixed this mainly for me, since it cost me 3 days to import 35GB of footage due to having to retry again and again. So if anything of this jumps out as nonsensical, please tell me.

Type:

  • Bug fix
  • New feature
  • Breaking change
  • Documentation

Camera:

  • GoPro
  • Insta360
  • DJI
  • Android
  • This PR adds a new camera

Component:

  • Core logic
  • Import
  • Merging
  • Firmware Update
  • Video Manipulation

Checklist before approval:

  • Linter pass
  • Build pass

My HERO12 did not like being asked for more than about 5-7 files
simultaneously, but dropped some of the /gp/gpMediaMetadata with a
timeout. So after the files where the call to gpMediaMetadata was
successfull were downloaded, I got presented with a bunch of errors
where it didn't work, and of cause the files were not downloaded.

Switching to a retrying approach means that we still hammer the GoPro
for the first couple seconds, but allow the requests to proceed later.

Some of this is still WIP - the config file has a timeout option, that I
dropped since I do not understand enough go to incorporate it, yet.
@klaernie
Copy link
Contributor Author

klaernie commented Sep 6, 2024

Now the linter is happy - seems like I did not understand what it was failing on at the time I wrote this.

@KonradIT KonradIT merged commit 6574c17 into KonradIT:development Sep 7, 2024
3 checks passed
@klaernie klaernie deleted the retryablehttp branch September 7, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants