Skip to content

Commit

Permalink
google_dataflow_job - Fix bug where the wrong error variable wa… (#5739)
Browse files Browse the repository at this point in the history
  • Loading branch information
c2thorn authored Mar 5, 2020
1 parent 90a4942 commit 43c46a8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions google/resource_dataflow_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,17 @@ func resourceDataflowJobDelete(d *schema.ResourceData, meta interface{}) error {

_, updateErr := resourceDataflowJobUpdateJob(config, project, region, id, job)
if updateErr != nil {
gerr, isGoogleErr := err.(*googleapi.Error)
gerr, isGoogleErr := updateErr.(*googleapi.Error)
if !isGoogleErr {
// If we have an error and it's not a google-specific error, we should go ahead and return.
return resource.NonRetryableError(err)
return resource.NonRetryableError(updateErr)
}

if strings.Contains(gerr.Message, "not yet ready for canceling") {
// Retry cancelling job if it's not ready.
// Sleep to avoid hitting update quota with repeated attempts.
time.Sleep(5 * time.Second)
return resource.RetryableError(err)
return resource.RetryableError(updateErr)
}

if strings.Contains(gerr.Message, "Job has terminated") {
Expand Down

0 comments on commit 43c46a8

Please sign in to comment.