[英]How does Firebase update one callable function when you modify a code used by many other functions
I find myself in this situation way too often, and I can't find a clear explanation as to what is the right way to go.我发现自己经常遇到这种情况,而且我找不到关于 go 的正确方法的明确解释。
Say you have (n) callable functions, (m) triggers, that all use an internal piece of code that you update.假设您有 (n) 个可调用函数,(m) 个触发器,它们都使用您更新的一段内部代码。 Should you deploy all functions that use that code, or updating one of them will propagate to the others?
您应该部署使用该代码的所有功能,还是更新其中一个会传播到其他功能?
PS: When I deploy the whole project, it usually fails. PS:当我部署整个项目时,它通常会失败。 So now I only deploy functions individually which seems to work better.
所以现在我只单独部署功能似乎效果更好。 But deploying functions one by one is very tedious.
但是一个一个的部署功能是非常繁琐的。 Even when I deploy a list of functions it fails ie:
firebase deploy --only functions:function1,function2
即使当我部署函数列表时它也会失败,即:
firebase deploy --only functions:function1,function2
Unfamiliar with the answer to your question, I ran a quick test in typescript.不熟悉你的问题的答案,我在 typescript 进行了快速测试。
exports.testing1 = functions.https.onCall(test1);
exports.testing2 = functions.https.onCall(test2);
export async function getString(): Promise<(String)>{
return("Hello test");
//return "Hello World";
}
export async function test1(){
//console.log("New test1");
console.log(await getString());
}
export async function test2(){
console.log(await getString());
}
I added these functions, then switched out the return hello test for hello world in the helper function, and added in the commented out New test 1 print.我添加了这些功能,然后在 helper function 中关闭了 hello world 的 return hello test,并在注释掉的 New test 1 print 中添加。 Then I ran
然后我跑了
firebase deploy --only functions:testing1
Then called both functions again.然后再次调用这两个函数。 testing1 updated to the new output, testing2 did not.
testing1更新到新的output,testing2没有。
I appears that each functions compile completely, and run in their own runtime environment, which makes sense for stability and scalability purposes.我认为每个函数都可以完全编译,并在它们自己的运行时环境中运行,这对于稳定性和可扩展性来说是有意义的。 Therefore, we can conclude updating a helper function and then not updating the entire project could cause some functions to use the old helper function.
因此,我们可以得出结论,更新 helper function 然后不更新整个项目可能会导致某些功能使用旧 helper function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.