GoogleCloudPlatform / appengine-gcs-client

App Engine-Cloud Storage custom client library
Apache License 2.0
124 stars 112 forks source link

storage_api: Avoid OverQuotaError from get_service_account_name #53

Open evanj opened 7 years ago

evanj commented 7 years ago

Commit 10e7febf00 assigned app_identity.get_service_account_name to a local variable, outside of the if statement. This means it gets called every time this function is called, which makes an RPC on App Engine. During periods of high activity, this can exceed the per-minute API quota and raise OverQuotaError.

To fix this, only call this if local_run() is True, which should only happen in development and never in App Engine production.

evanj commented 6 years ago

I just found a bug in this change, a year and a half later! This tweak makes this work with both unit tests and dev_appserver.py