我正在用 firebase 构建一个 JavaScript(react native)应用程序,我的想法是我想在 firebase 中编写一个函数,它向外部 api 发出几个 API 请求,然后向 stores 数据在 Firestore 中,我如何希望这种情况每 24 小时发生一次,或者每当特定用户数据(用户集合)中的某些属性发生变化时,基本上这些呈现给用户的数据每 24 小时发生变化,关于我如何处理的任何提示这个问题 ?
回答1
exports.scheduledFunction = functions.pubsub.schedule('every 24 hours').onRun((context) => {
console.log('This will be run every 24 hours!');
return null;
});