我正在使用Firebase作为群组协作应用程序(如Whatsapp),我正在使用云功能来确定哪些手机通讯录也在使用我的应用程序(再次类似于Whatsapp).云函数运行正常,直到我开始在函数日志中看到以下日志以进行某些调用.
Function execution took 60023 ms, finished with status: 'timeout'
我做了一些调试,发现对于这个特定的用户,他在手机的通讯录上有很多联系人,所以显然需要弄清楚哪些联系人正在使用该应用程序的工作也增加到了需要花费的时间. 60秒 以下是Cloud Function的代码
// contactsData is an array of contacts on the user's phone
// Each contact can contain one more phone numbers which are
// present in the phoneNumbers array. So, essentially, we need
// to query over all the phone numbers in the user's contact book
contactsData.forEach((contact) => {
contact.phoneNumbers.forEach((phoneNumber) => {
// Find if user with this phoneNumber is using the app
// Check against mobileNumber …Run Code Online (Sandbox Code Playgroud) javascript firebase firebase-realtime-database google-cloud-functions