Skip to content

fix: getToken() returns existing promise to a token if one exists instead of a new token.#2648

Merged
jonathanedey merged 3 commits into
masterfrom
je-get-token
Aug 1, 2024
Merged

fix: getToken() returns existing promise to a token if one exists instead of a new token.#2648
jonathanedey merged 3 commits into
masterfrom
je-get-token

Conversation

@jonathanedey
Copy link
Copy Markdown
Collaborator

@jonathanedey jonathanedey commented Jul 29, 2024

  • Concurrent calls to getToken() don't utilize cache because of a race condition which causes multiple token refreshes.
  • Fixing by returning the existing promise to a token if one is still pending instead of requesting a new one.

Copy link
Copy Markdown
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jonathanedey jonathanedey merged commit 745c22e into master Aug 1, 2024
@jonathanedey jonathanedey deleted the je-get-token branch August 1, 2024 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Optimize Token Retrieval for Messaging#sendEach to Reduce Unnecessary Fetch Requests

2 participants