Skip to content

Commit

Permalink
Add comment explaining sleeps.
Browse files Browse the repository at this point in the history
  • Loading branch information
nat-henderson authored Oct 25, 2019
1 parent a8752f1 commit d1a1501
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func resourceGoogleServiceAccountCreate(d *schema.ResourceData, meta interface{}
}

d.SetId(sa.Name)
// This API is meant to be synchronous, but in practice it shows the old value for
// a few milliseconds after the update goes through. A second is more than enough
// time to ensure following reads are correct.
time.Sleep(time.Second)

return resourceGoogleServiceAccountRead(d, meta)
Expand Down Expand Up @@ -137,6 +140,9 @@ func resourceGoogleServiceAccountUpdate(d *schema.ResourceData, meta interface{}
if err != nil {
return fmt.Errorf("Error updating service account %q: %s", d.Id(), err)
}
// This API is meant to be synchronous, but in practice it shows the old value for
// a few milliseconds after the update goes through. A second is more than enough
// time to ensure following reads are correct.
time.Sleep(time.Second)
}

Expand Down

0 comments on commit d1a1501

Please sign in to comment.