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

Concurrency with Cloud Functions for Firebase V2 #138

Open
leomp12 opened this issue Feb 8, 2022 · 2 comments
Open

Concurrency with Cloud Functions for Firebase V2 #138

leomp12 opened this issue Feb 8, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@leomp12
Copy link
Member

leomp12 commented Feb 8, 2022

Is your feature request related to a problem? Please describe.
Concurrency sometimes is important...
E-Com Plus and integrated solutions webhooks may occur almost at the same time, and it comes with some problems to process status changes and other flows.
Also, we like to be fast and cold starts are not cool 😛

Describe the solution you'd like

Our upcoming version of Cloud Functions uses Cloud Run as its underlying infrastructure. You'll see fewer cold starts because each function instance will now be able to handle 80 concurrent requests by default, as opposed to the current Cloud Functions for Firebase limit of 1.

With Cloud Functions 2nd gen we can enable concurrency, then receive many webhooks at the same execution to be able to control with easy "duplicated" webhooks:

const handlingIds = [];
if (!handlingIds.includes(resourceId)) {
  handlingIds.push(resourceId)
  /* await do stuff */
  const handlingIndex = handlingIds.indexOf(resourceId)
  handlingIds.splice(handlingIndex, -1)
}
// skip handling current webhook if same resource id already being treated

Describe alternatives you've considered
#137

Additional context
Cloud Run seems to be the best of both Worlds, but we can deal with Firebase Alpha (private) features? It is still very important that partners can use this starter template with easy.

Update: public beta

@leomp12
Copy link
Member Author

leomp12 commented Jun 8, 2022

Public beta now!

@leomp12 leomp12 changed the title Concurrency with Cloud Functions for Firebase V2 (Alpha) Concurrency with Cloud Functions for Firebase V2 Jun 8, 2022
@leomp12 leomp12 removed the question Further information is requested label Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants