Skip to content

fix(azure/database): serverInfoOnce caches an empty result for the client lifetime after one transient page error #241

Description

@cristim

Found in the review of #240 (merged). Related: #94, #240.

providers/azure/services/database/client.go:719 and :730 call c.serverInfoOnce.Do(func() { c.azConfig, c.deployment = c.fetchServerInfo(ctx) }). fetchServerInfo (:744) returns empty values when a pager page errors or the context is cancelled, and sync.Once never runs again. After #240 empty means the explicit unknown, so every later AZConfig/Deployment lookup in the process reports unknown for the life of the client.

Failure scenario (probed in the #240 review): the first NextPage returns an error, the next call would succeed. The first lookup returns empty; the second lookup also returns empty because the Once is spent.

Suggested fix: replace sync.Once with a mutex and cache only a complete walk. Add a bound or backoff so a subscription that keeps erroring does not re-walk every server page on every recommendation.

Acceptance: a transient first-page error followed by a successful walk yields populated AZConfig/Deployment on the next lookup, covered by a test.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions