Skip to content

Flag link creation doesn't retry on HTTP 429 (rate_limited) #257

Description

@oleksii-furaiev-tide

Summary

create-flag-links: true fails silently for some flags when LaunchDarkly returns 429 rate_limited. The flag link requests in internal/ldclient/flag_links.go are not retried. #253 added retry/backoff for the flag listing requests only.

Version

launchdarkly/find-code-references-in-pull-request v2.3.0 (3d0cb58224bc446bd9fe84faab3a1c4d8134cf76). I checked the source of v2.3.3 and flag_links.go still has no retry handling.

What happens

The action emits a warning and moves on, so the job stays green and the flag link is never created:

Warning: Failed to create flag link for test-flag1
[POST https://app.launchdarkly.com/api/v2/flag-links/projects/test/flags/test-flag1] Flag link request failed [status=429]
{"code":"rate_limited","message":"You've exceeded the API rate limit. Try again later."}

Warning: Failed to create flag link for test-flag5
[POST https://app.launchdarkly.com/api/v2/flag-links/projects/test/flags/test-flag5] Flag link request failed [status=429]
{"code":"rate_limited","message":"You've exceeded the API rate limit. Try again later."}

The PR in question removed several flags ("Flag extinct, Removed 7 other flags"), so the action sends a burst of POSTs. The account's rate limit is shared with other CI jobs, so 2 of them were rejected.

Expected behaviour

Flag link requests should handle 429 the same way the flag listing does after #253: honour Retry-After / the rate-limit reset headers, fall back to exponential backoff, and give up after a bounded time. Ideally the action would also:

  • space out the requests when quota is nearly exhausted;
  • treat 409 (link already exists) as success;
  • report a failure summary (or an optional fail-on-flag-link-error input), because the current warning is easy to miss.

Related

#253 - Retry rate-limited flag requests (listing only)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions