为什么Firebase的Cron预定云功能在太平洋时间而不是UTC运行?
我有一个预定的云功能(使用),它将在每周一12:00运行为什么Firebase的Cron预定云功能在太平洋时间而不是UTC运行?,firebase,cron,google-cloud-functions,google-cloud-scheduler,Firebase,Cron,Google Cloud Functions,Google Cloud Scheduler,我有一个预定的云功能(使用),它将在每周一12:00运行 export const updateHighScores = functions.pubsub.schedule('0 0 * * 1').onRun((context) => { // (code) // console.log(‘This code will run every Monday at 12:00 AM UTC’); }); 我希望它在UTC上午12:00运行;然而,当UTC午夜来临时,什么
export const updateHighScores = functions.pubsub.schedule('0 0 * * 1').onRun((context) => {
// (code)
// console.log(‘This code will run every Monday at 12:00 AM UTC’);
});
我希望它在UTC上午12:00运行;然而,当UTC午夜来临时,什么也没发生。所以我就上床睡觉了,为我预定的云计算功能不能正常工作感到难过,但我决定继续努力
但第二天我检查了日志,它似乎确实起作用了,但它在太平洋时间凌晨12:00运行
- 云函数的区域设置为us-central1,但我认为这不会影响这一点李>
- 我的电脑的时区设置为太平洋时间,我位于中部时间,但我认为两者都无关紧要李>
- 我还点击了Firebase和Google云平台,看看是否有影响它的设置,但没有找到任何东西
时区是使用function builder API设置的。您可以在中阅读相关内容。我做了类似的事情
exports.scheduledFunction = functions.pubsub
.schedule("0 4 * * *")
.timeZone("Asia/Baku")
.onRun((context) => {
groupCustomers.set({});
tables.set({});
calledCustomers.set({});
groups.set({
A: { name: "Altering", activeOnTablet: false },
});
return null;
});
知道了。再次感谢道格!我在这里编辑了答案,以反映您可以使用函数的BuilderAPI设置时区的事实。记录在案。为多个时区安排功能的最佳实践是什么?可能是不同的功能。我认为这可能是一个很好的问题:)