这是indexloc提供的服务,不要输入任何密码
Skip to content

Improve GetDatabase Caching for Firestore Function Deployments #8681

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

Merged
merged 3 commits into from
May 30, 2025

Conversation

taeold
Copy link
Contributor

@taeold taeold commented May 30, 2025

When deploying multiple 2nd gen Firestore functions, we send many concurrent GetDatabase API requests. The existing caching mechanism was not effective for these simultaneous calls, leading to redundant requests and (potentially) API quota issue.

This change introduces caching for the promise of the GetDatabase API call itself, in addition to the result. This should improves cache hits for concurrent requests, resulting in more reliable function deployments.

Copy link
Member

@inlined inlined left a comment

Choose a reason for hiding this comment

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

This is different from the pattern we use in getExistingBackend (passing the cache via Context) to avoid accidentally using a cache, but I can see arguments that the problem is less of a concern here because we're not modifying the database region between calls.

@taeold taeold merged commit 7133888 into master May 30, 2025
48 of 50 checks passed
@taeold taeold deleted the dl-firestore-fn-deploy branch May 30, 2025 18:53
@github-project-automation github-project-automation bot moved this from Approved [PR] to Done in [Cloud] Extensions + Functions May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants