javascript - Run Azure Function every 10 minutes starting at 1 second before each 00:x0 - Stack Overflow

An Azure Function must run every 10 minutes indefinitely starting at 00:59:59 (hour, minute, seconds).

An Azure Function must run every 10 minutes indefinitely starting at 00:59:59 (hour, minute, seconds). The cron schedule I am using is unsuccessful.

I am using a Javascript Azure Function based on a timer, e.g.,

module.exports = async function (context, myTimer) {
    var timeStamp = new Date().toISOString();

I don't believe there is a setting within an Azure Function to set a start date/time. The cron scheduler seems like the only option.

According to the Azure Functions documentation:

The schedule expression is a CRON expression that includes 6 fields:

{second} {minute} {hour} {day} {month} {day of the week}

Note that many of the cron expressions you find online omit the {second} field, so if you copy from one of those you'll have to adjust for the extra field.

Examples provided by the documentation:

To trigger once every 5 minutes: 0 */5 * * * *

To trigger at 9:30 AM every day: 0 30 9 * * *

59 */10 * * * * results in these execution times:

  • Result: 11:40:59 | Desired: 11:39:59
  • Result: 11:30:59 | Desired: 11:29:59
  • Result: 11:20:59 | Desired: 11:19:59
  • Result: 11:10:59 | Desired: 11:09:59

59 */10-1 * * * * is not supported.

The reason the Azure Function needs to start its initial run at 00:59:59 is that the function pares event timestamps that occurred in the previous 10 minutes to a 10-minute UTC time interval. If any event timestamps to the minute level match a the UTC timestamp within the interval to the minute level (e.g., 2018-12-21Txx:3x:xx.xxxZ of the event at 2018-12-21T00:35:18.894Z matches any UTC timestamp of this pattern 2018-12-21Txx:3x:xx.xxxZ), an action is performed.)

I am stuck. Any help is appreciated. Thank you.

An Azure Function must run every 10 minutes indefinitely starting at 00:59:59 (hour, minute, seconds). The cron schedule I am using is unsuccessful.

I am using a Javascript Azure Function based on a timer, e.g.,

module.exports = async function (context, myTimer) {
    var timeStamp = new Date().toISOString();

I don't believe there is a setting within an Azure Function to set a start date/time. The cron scheduler seems like the only option.

According to the Azure Functions documentation:

The schedule expression is a CRON expression that includes 6 fields:

{second} {minute} {hour} {day} {month} {day of the week}

Note that many of the cron expressions you find online omit the {second} field, so if you copy from one of those you'll have to adjust for the extra field.

Examples provided by the documentation:

To trigger once every 5 minutes: 0 */5 * * * *

To trigger at 9:30 AM every day: 0 30 9 * * *

59 */10 * * * * results in these execution times:

  • Result: 11:40:59 | Desired: 11:39:59
  • Result: 11:30:59 | Desired: 11:29:59
  • Result: 11:20:59 | Desired: 11:19:59
  • Result: 11:10:59 | Desired: 11:09:59

59 */10-1 * * * * is not supported.

The reason the Azure Function needs to start its initial run at 00:59:59 is that the function pares event timestamps that occurred in the previous 10 minutes to a 10-minute UTC time interval. If any event timestamps to the minute level match a the UTC timestamp within the interval to the minute level (e.g., 2018-12-21Txx:3x:xx.xxxZ of the event at 2018-12-21T00:35:18.894Z matches any UTC timestamp of this pattern 2018-12-21Txx:3x:xx.xxxZ), an action is performed.)

I am stuck. Any help is appreciated. Thank you.

Share Improve this question asked Dec 24, 2018 at 18:37 hcdocshcdocs 1,3094 gold badges24 silver badges35 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

It's a bit of a mouthful, but what you want is 59 9,19,29,39,49,59 * * * *.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744765601a4592439.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信