firebase 檔案解釋了如何將函式配置為每 5 分鐘運行一次。我想每隔一個小時就相當精確地運行一個函式。我可以輕松地將它安排為每小時運行一次,但是如何讓它在整個小時內運行,8:00、9:00 ......
我準備好它只會在大約整小時運行。
uj5u.com熱心網友回復:
使用所謂的
“unix-cron 字串格式”(* * * * *),而不是使用英文描述來指定確切的(或重復的)分鐘、小時、日、月或一周中的某天日程安排。
“配置 cron 作業計劃”的鏈接:https : //cloud.google.com/scheduler/docs/configuring/cron-job-schedules
而這篇文章對兩者進行了解釋:英文描述和unix-cron字串格式:https : //firebase.googleblog.com/2019/04/schedule-cloud-functions-firebase-cron.html
最終你的函式應該是這樣的:
exports.testFunction = functions
.pubsub.schedule('0 * * * *') // every hour at the 0 min, every day, every month
.onRun(...//the code to run);
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/340283.html
