Skip to content

Use Wait() not Get() to check operation status

NOTE THAT THIS FORK IS MAINTAINED FOR CRITICAL BUG FIXES AFFECTING RUNNING COSTS ONLY. NO OTHER CONTRIBUTIONS WILL BE ACCEPTED.

What critical bug this MR is fixing?

Replaces the .Get() call on the operation read requests with .Wait().

.Get() returns the status of the operation immediately. Which usually means that we need to loop through these requests several times until the operation reaches the DONE state. And this counts up the total number of made API requests.

The .Wait() call should hang until the result is sent back but no longer than the default 2 minutes timeout. This by design reduces the number of API calls in most cases.

As .Wait() can still responde with the operation state different than DONE, we should still loop until it's done and therefore our existing backoff mechanism is still in play.

How does this change help reduce cost of usage? What scale of cost reduction is it?

The .Wait() API call was designed to reduce the number of calls that the GCP API client is making when managing different GCP resources. It should significantly reduce the number of API calls and as that move the calls number further from the API quota limits.

In what scenarios is this change usable with GitLab Runner's docker+machine executor?

docker+machine executor used in Google Cloud Platform.

closes #50 (closed)

Edited by Tomasz Maczukin

Merge request reports