Skip to content

fix: set MaxRetryDelay to honour Graph API Retry-After up to 315s#119

Open
Jeenil wants to merge 1 commit into
microsoft:mainfrom
Jeenil:fix-max-retry-delay
Open

fix: set MaxRetryDelay to honour Graph API Retry-After up to 315s#119
Jeenil wants to merge 1 commit into
microsoft:mainfrom
Jeenil:fix-max-retry-delay

Conversation

@Jeenil

@Jeenil Jeenil commented May 27, 2026

Copy link
Copy Markdown

Summary

Fixes #118.

The azure-sdk retry policy correctly reads the Retry-After header but caps the wait at MaxRetryDelay, which defaults to 60 s. The Graph API Identity Governance endpoint returns Retry-After values up to 315 s, causing the SDK to retry too early, re-hit 429, and exhaust retries before the throttle window clears.

Setting MaxRetryDelay: 600 * time.Second in both NewRetryOptionsForReadAfterCreate and NewRetryOptions ensures the full Retry-After duration is respected.

#133 ("apply retry policy by default") makes retry fire on every request, including the read-after-create/existence-check path. but it doesn't set MaxRetryDelay, so those retries are still capped at 60s. this pr is complementary: #133 = retry at all, this pr = retry waits the full Retry-After window. rebased on top of #133 so it applies cleanly.

Changes

  • internal/clients/options.go: added MaxRetryDelay: 600 * time.Second to both NewRetryOptionsForReadAfterCreate and NewRetryOptions.

Note to maintainers

I apologies the original issue title ("Retry-After not honoured") was misleading. The real problem is the missing MaxRetryDelay cap. I've updated the issue body with the corrected root cause.

I'm relatively new to contributing to this provider and happy to revise the approach if the 600 s value or placement isn't right. Please let me know if you'd prefer a different cap, a configurable option, or if this belongs somewhere else in the retry pipeline. Thank you for reviewing

@hcoberdalhoff

Copy link
Copy Markdown

Related to #129 ?

@TimurDudhaschGK

Copy link
Copy Markdown

Hey @ms-henglu could we get attention to this? Identity Governance endpoints are really petulant. The workarounds are worse than not implementing them at all...

I hope nothing speaks against it, thanks!

@Jeenil
Jeenil force-pushed the fix-max-retry-delay branch from 842950a to 8272e52 Compare July 14, 2026 13:25
@Jeenil

Jeenil commented Jul 14, 2026

Copy link
Copy Markdown
Author

yes, its related. #129 was just fixed by #133 and this pr is complementary to #133 makes retry fire everywhere but does not set MaxRetryDelay, so those retries are still capped at 60s, which is what this fixes (identity governance returns retry-after up to ~315s). i also rebased on top of #133 so it applies cleanly.

the baseline policy #133 added in client.go has the same 60s cap. i kept this pr scoped to options.go, but happy to open a follow-up pr to cover client.go too if you'd prefer it everywhere. sorry for the delay!

@Jeenil

Jeenil commented Jul 14, 2026

Copy link
Copy Markdown
Author

@Jeenil please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

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.

data.msgraph_resource fails immediately on 429. Retry

3 participants