Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache auth client #661

Merged
merged 1 commit into from
Jun 17, 2015
Merged

cache auth client #661

merged 1 commit into from
Jun 17, 2015

Conversation

ofrobots
Copy link
Contributor

The authClient from the google-auth-library ought to be cached. Otherwise we end up creating a new AuthClient on each request which ends up fetching fresh credentials on every API request. This can potentially double the latency of each API request.

I can add JSDoc about config.authClient if this (quick) patch seems reasonable.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jun 17, 2015
@@ -476,6 +476,10 @@ util.shouldRetryRequest = shouldRetryRequest;
* @param {function} callback - The callback function.
*/
function getAuthClient(config, callback) {
if (config.authClient) { // cached authClient
callback(null, config.authClient);

This comment was marked as spam.

@stephenplusplus
Copy link
Contributor

Thanks for catching this! A mention in the JSdocs would be great.

The authClient from the google-auth-library ought to be cached. Otherwise we end up creating a new AuthClient on each request which ends up fetching fresh credentials on every API request. This can potentially double the latency of each API request.
@ofrobots
Copy link
Contributor Author

Thanks. I have addressed the comments.

stephenplusplus added a commit that referenced this pull request Jun 17, 2015
@stephenplusplus stephenplusplus merged commit c6a4ccd into googleapis:master Jun 17, 2015
@stephenplusplus
Copy link
Contributor

Great, thanks!

@ofrobots ofrobots deleted the patch-1 branch June 17, 2015 16:57
sofisl pushed a commit that referenced this pull request Oct 11, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-language).
sofisl pushed a commit that referenced this pull request Oct 13, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/mocha](https://github.com/DefinitelyTyped/DefinitelyTyped) | [`^8.0.0` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fmocha/8.2.3/9.1.1) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/compatibility-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fmocha/9.1.1/confidence-slim/8.2.3)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-language).
sofisl pushed a commit that referenced this pull request Nov 10, 2022
* fix: use require() to load JSON protos

The library is regenerated with gapic-generator-typescript v1.3.1.

Committer: @alexander-fenster
PiperOrigin-RevId: 372468161

Source-Link: googleapis/googleapis@75880c3

Source-Link: googleapis/googleapis-gen@77b1804

* 🦉 Updates from OwlBot

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Nov 11, 2022
* chore: updated samples/package.json [ci skip]

* chore: updated CHANGELOG.md [ci skip]

* chore: updated package.json

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this pull request Nov 17, 2022
this tests brings potential flakiness: only 6 images can be created per hour per GCP project.
sofisl pushed a commit that referenced this pull request Jan 10, 2023
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped) | [`^14.0.0` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-dlp).
sofisl pushed a commit that referenced this pull request Jan 24, 2023
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/528df7ed-227f-470a-afc7-453221617bc3/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@901ddd4
Source-Link: googleapis/synthtool@f96d3b4
sofisl pushed a commit that referenced this pull request Jan 25, 2023
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/528df7ed-227f-470a-afc7-453221617bc3/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@901ddd4
Source-Link: googleapis/synthtool@f96d3b4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants