Home > Blockchain >  Azure Chrono Trigger Notation Not Working
Azure Chrono Trigger Notation Not Working

Time:12-08

I am trying to create a chrono trigger to run an Azure function at 11pm, 12am, 1am, 2am, 3am, and 4am on the hour. I'm using the following notation: 0 0 23,0,1,2,3,4 * * * but my Function never runs.

I've changed it to different individual times, eg 0 0 23 * * * and 0 0 1 * * * and everything fires off okay.

Another strange behavior I noticed is when I change it to 0 0 23-3 * * *, my Function will run every hour OUTSIDE the range 23HR-03HR.

Does anyone know what's could be causing this behavior? Could there be an issue with time ranges in Azure wrapping from one day into the next?

CodePudding user response:

Could there be an issue with time ranges in Azure wrapping from one day into the next?

Hour ranges that cross over midnight are not supported and are interpreted the other way round.

Azure Functions uses the NCronTab library to interpret NCRONTAB expressions. Checking its issues, I found ranges that cross over midnight and Hour semantics.

Is it possible to provide a range that crosses over midnight (e.g. 21-5)?
No, that's the same as 5-21.

Not tested, but what if you use the notation 0 0 0,1,2,3,4,23 * * *?

CodePudding user response:

You can combine the value 23 with the range 0-4, like this:

0 0 23,0-4 * * *

As @rickvdbosch stated in their answer, Azure Functions uses NCronTab to intrepret cron expressions. There are sites you can use to test NCronTab expressions, such as https://ncrontab.swimburger.net/.

  • Related