我需要安排Firebase Cloud Function调用,但是使用给定的时间戳,而不是像Cron。
有谁知道如何实现这样的事情?
即使是"常规"功能,有可能吗?
答案 0 :(得分:0)
Cloud Functions中没有任何内置功能可以在特定日期触发代码。但是你可以通过在函数中添加一个简单的条件,轻松地在periodically triggered function之上构建它。
例如:如果你有一个每晚午夜都会触发的功能,你可以在你的代码中添加一个额外的检查,看看今天是否是#34;
exports.accountcleanup = functions.https.onRequest((req, res) => {
var now = new Date();
if (now.getFullYear() == 2017 &&
now.getMonth() === 11 && // Months are 0 based, so 11 is December
now.getDate() === 28) {
...