[英]Firebase storage (files) backup
We have a scheduled function that processes a firebase backup.我们有一个预定的 function 处理一个 firebase 备份。
For Firestore DB, we use a built-in method - https://firebase.google.com/docs/firestore/solutions/schedule-export对于 Firestore DB,我们使用内置方法 - https://firebase.google.com/docs/firestore/solutions/schedule-export
However, we also need to back up user files that are placed in the storage.但是,我们还需要备份放在存储中的用户文件。 I did not find a good solution for files backup, so I ended up using of
bucket.copy
method - it will copy files one by one and put them into another storage.我没有找到一个很好的文件备份解决方案,所以我最终使用
bucket.copy
方法 - 它会一个一个地复制文件并将它们放入另一个存储中。
That worked fine for some period, but now the function experiences a timeout error (as we have a lot of files already) - Function execution took 540026 ms, finished with status: 'timeout'
.这在一段时间内运行良好,但现在 function 出现超时错误(因为我们已经有很多文件)-
Function execution took 540026 ms, finished with status: 'timeout'
。
As the amount of files is growing every day, I am not sure how to fix the timeout
issue.由于文件数量每天都在增长,我不确定如何解决
timeout
问题。 Could you please advise?您能否提一些建议?
Would you recommend using another way?你会推荐使用另一种方式吗? If so, please specify
如果有,请说明
Increase your memory and add parameter in functions增加你的 memory 并在函数中添加参数
Try below code试试下面的代码
const runtimeOpts = {
timeoutSeconds: 300,
memory: '1GB'
}
exports.getMessages = functions.runWith(runtimeOpts).https.onCall((data, context) => {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.