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

azurerm_pim_eligible_role_assignment: use timeout from ctx instead of a fix value #22682

Merged
merged 2 commits into from Jul 26, 2023

Conversation

wuxu92
Copy link
Contributor

@wuxu92 wuxu92 commented Jul 26, 2023

may fixes #22588

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a comment inline, since this default value will never get used

@@ -653,3 +653,10 @@ func deleteEligibilityRoleAssignmentSchedule(ctx context.Context, client *roleel
return result, "Deleted", nil
}
}

func waitTimeoutFromCtx(ctx context.Context, defaultValue time.Duration) time.Duration {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this default value will never get used - ctx's should always be wrapped by a timeout, so can we remove this method and instead use:

deadline, ok := ctx.Deadline()
if !ok {
  return fmt.Errorf("internal-error: context had no deadline")
}

// ...
Timeout: time.Until(deadline),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that makes seanse. updated in this way.

Copy link
Member

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for this @wuxu92

@tombuildsstuff tombuildsstuff added this to the v3.67.0 milestone Jul 26, 2023
@tombuildsstuff tombuildsstuff merged commit 5269adb into hashicorp:main Jul 26, 2023
22 checks passed
tombuildsstuff added a commit that referenced this pull request Jul 26, 2023
@wuxu92 wuxu92 deleted the pimrole/timeout branch July 27, 2023 02:48
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants