launchdarkly / ld-find-code-refs

Build tool for automatically sending feature flag code references to LaunchDarkly
https://launchdarkly.com
Other
45 stars 34 forks source link

feat: respect X-Ratelimit-Reset when retrying API requests #434

Closed jonathan-ostrander closed 4 months ago

jonathan-ostrander commented 4 months ago

Fixes #433. Fallback to default behavior (the RetryWaitMin and RetryWaitMax lines were removed because the hardcoded values were already the default in go-retryablehttp) in the case where X-Ratelimit-Reset is not available for some reason.

jonathan-ostrander commented 4 months ago

Just a friendly ping @jazanne since you approved my coworker's PR a few weeks ago. Also, 👋 from Fishtown since I see you're also Philly-based.

jazanne commented 4 months ago

hey @jonathan-ostrander thanks for this change! I'm working on getting it through the reviewing process. just out of curiosity, how are you all using code refs? via GitHub action, or the CLI directly?

jonathan-ostrander commented 4 months ago

We use the GitHub Action. I was actually going to follow-up with a feature request issue and another PR for adding an option to scan all projects in an organization instead of a manually configured list. Right now we hack around this problem by having a step hit LD's API to list all of our projects and then we run the find code refs action for each of those.

Currently it works alright, but ends up failing ~10% of the time because of rate limit issues.

jazanne commented 4 months ago

...scan all projects in an organization instead of a manually configured list. Right now we hack around this problem by having a step hit LD's API to list all of our projects and then we run the find code refs action for each of those.

@jonathan-ostrander that's really useful context. Just to clarify, monorepo configuration is too inflexible for you all, and would require a lot of manual updates and changes. Does that mean that your actions are configured to scan all directories for flags in all projects, instead of a subset of directories for some projects/flags?

jonathan-ostrander commented 4 months ago

@jazanne Yes, we don't create LD projects that often but when we do it would be nice to avoid the manual step of adding another project to a list in a GHA. That's a less important follow-up though. This change is a lot more helpful for us because currently ~10% of our actions are failing on the 429s.