Skip to content

Commit

Permalink
chore(GCP): improve network deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminch committed Oct 18, 2024
1 parent 3a81ba9 commit c02311e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/gcp/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func DeleteExpiredVPCs(sessions GCPSessions, options GCPOptions) {

log.Info(fmt.Sprintf("Deleting network `%s`", networkName))
ctxDeleteNetwork, cancelNetwork := context.WithTimeout(context.Background(), time.Second*60)
_, err = sessions.Network.Delete(ctxDeleteNetwork, &computepb.DeleteNetworkRequest{
operation, err := sessions.Network.Delete(ctxDeleteNetwork, &computepb.DeleteNetworkRequest{
Project: options.ProjectID,
Network: networkName,
})
Expand All @@ -196,12 +196,12 @@ func DeleteExpiredVPCs(sessions GCPSessions, options GCPOptions) {
}

// this operation can be a bit long, we wait until it's done
//if operation != nil {
// err = operation.Wait(ctxDeleteNetwork)
// if err != nil {
// log.Error(fmt.Sprintf("Error waiting for deleting subnet `%s`, error: %s", network.GetName(), err))
// }
//}
if operation != nil {
err = operation.Wait(ctxDeleteNetwork)
if err != nil {
log.Error(fmt.Sprintf("Error waiting for deleting subnet `%s`, error: %s", network.GetName(), err))
}
}

cancelNetwork()
}
Expand Down

0 comments on commit c02311e

Please sign in to comment.