Skip to content

Commit 06682c4

Browse files
authored
workbench: retry instance operations if they error out with 409: unable to queue the operation (#15158)
1 parent 01e56ba commit 06682c4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mmv1/products/workbench/Instance.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ virtual_fields:
130130
Desired state of the Workbench Instance. Set this field to `ACTIVE` to start the Instance, and `STOPPED` to stop the Instance.
131131
type: String
132132
default_value: "ACTIVE"
133+
error_retry_predicates:
134+
- 'transport_tpg.IsWorkbenchQueueError'
133135
parameters:
134136
- name: 'location'
135137
type: String

mmv1/third_party/terraform/transport/error_retry_predicates.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,17 @@ func IsRepositoryGroupQueueError(err error) (bool, string) {
304304
return false, ""
305305
}
306306

307+
// Retry if Workbench operation returns a 409 with a specific message for
308+
// enqueued operations.
309+
func IsWorkbenchQueueError(err error) (bool, string) {
310+
if gerr, ok := err.(*googleapi.Error); ok {
311+
if gerr.Code == 409 && (strings.Contains(strings.ToLower(gerr.Body), "unable to queue the operation")) {
312+
return true, "Waiting for other enqueued operations to finish"
313+
}
314+
}
315+
return false, ""
316+
}
317+
307318
// Retry if Monitoring operation returns a 409 with a specific message for
308319
// concurrent operations.
309320
func IsMonitoringConcurrentEditError(err error) (bool, string) {

0 commit comments

Comments
 (0)