简体   繁体   English

如何绕过 firebase 功能冷启动

[英]how to bypass firebase functions cold start

I am using the firebase Stripe API, and what is happening is my app doesn't have a lot of traffic yet, nor will it for a little while.我正在使用 firebase Stripe API,发生的事情是我的应用程序还没有很多流量,也不会有一段时间。 Firebase decided, after 2-3 minutes of no invocations on the function, it goes into cold start mode. Firebase 决定,在 function 上没有调用 2-3 分钟后,它进入冷启动模式。 This is unfortunate because it means my wait time from when a new user hits register, and goes to the checkout page, it is like 8 seconds.这很不幸,因为这意味着我从新用户点击注册到结帐页面的等待时间,大概是 8 秒。 How horrendous is that!那是多么可怕!

Anyways, does anyone know a way around this, maybe setting a script to run in the background at all times, or something I can do from inside firebase?无论如何,有没有人知道解决这个问题的方法,也许设置一个脚本始终在后台运行,或者我可以从 firebase 内部做些什么?

One way to help is to add a "cold-start" command to the Cloud Function (ie a "no-op" invocation/call), and invoke it when your user starts the checkout process (before collecting any information).一种帮助方法是向 Cloud Function 添加“冷启动”命令(即“无操作”调用/调用),并在您的用户开始结帐过程时调用它(在收集任何信息之前)。 If the User doesn't complete check-out, no-harm-no-foul;如果用户未完成结帐,则不伤害不犯规; if they do , the cloud function has already been started.如果他们这样做了,那么云 function 已经启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM