Skip to content

Commit

Permalink
Work around nil pointer in api.Client and ReadYourRights
Browse files Browse the repository at this point in the history
- when setting ReadYourRights() on client instance that already has this
  feature set, the client's replicationStore is re-initialized to nil.
  • Loading branch information
benashz committed Dec 20, 2021
1 parent 21c490f commit 0f3d984
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-hclog v1.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-retryablehttp v0.7.0
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.5
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.0
Expand Down
5 changes: 4 additions & 1 deletion util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,10 @@ func StatusCheckRetry(statusCodes ...int) retryablehttp.CheckRetry {
// SetupCCCRetryClient for handling Client Controlled Consistency related
// requests.
func SetupCCCRetryClient(client *api.Client, maxRetry int) {
client.SetReadYourWrites(true)
if !client.ReadYourWrites() {
client.SetReadYourWrites(true)
}

client.SetMaxRetries(maxRetry)
client.SetCheckRetry(StatusCheckRetry(http.StatusNotFound))

Expand Down

0 comments on commit 0f3d984

Please sign in to comment.