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

feat: coalesce concurrent authentication calls #689

Merged
merged 3 commits into from
Apr 2, 2025

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented Mar 19, 2025

Resolves #688


Before the change?

  • Concurrent identical calls to getInstallationAuthentication would result in redundant token acquisition (generate a JWT, post to /app/installations/.../access_tokens, and cache the token, with the last one winning)

After the change?

  • Concurrent identical calls to getInstallationAuthentication will all resolve to the same promise, ensuring that the token is only acquired once.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
    • N/A, since this is really just a performance optimization

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

No breaking changes. The only observable impact should be that API usage goes down and request throughput goes up when concurrent requests are made that need authentication. The improvement is most noticeable without octokit/plugin-throttling.js#779, since currently authentications are treated as writes, meaning they incur an automatic 1 second penalty between them.


Copy link
Contributor

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

@wolfy1339 wolfy1339 merged commit 76398eb into octokit:main Apr 2, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from 🆕 Triage to ✅ Done in 🧰 Octokit Active Apr 2, 2025
Copy link
Contributor

github-actions bot commented Apr 2, 2025

🎉 This PR is included in version 7.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@gr2m
Copy link
Contributor

gr2m commented Apr 3, 2025

Really great work y'all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT]: coalesce concurrent authentication calls
3 participants