首页 > 解决方案 > 增加 Firebase HTTPs Callable iOS Swift 中的时间间隔

问题描述

我正在使用我的 iOS Swift 代码,并已成功安装所有依赖项。现在,我正在尝试增加 Firebase 函数中的 timeoutInterval。

functions.httpsCallable("getData").call(){ (result, error) in
     guard error == nil else {
        print(error)
        return
      }
     .........
}

标签: iosswiftfirebasegoogle-cloud-functions

解决方案


你不能从客户端做到这一点。您将不得不增加函数的超时时间,如下所示:

const runtimeOpts = {
  timeoutSeconds: 300,
  memory: '1GB'
}

exports.getData = functions
  .runWith(runtimeOpts)
  https.onCall((data, ctx) = > {
    // the function
  });

timeoutSeconds 的最大值为 540,即 9 分钟。

详细信息可以在文档中找到


推荐阅读