Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
354 views
in Technique[技术] by (71.8m points)

Azure function (Time trigger) is triggering only when opening the Azure portal

I have created a Time trigger Azure function, which is triggered in 2 Hrs of interval. Every time I open the Azure portal, it is triggered and after that, it is not getting triggered.

I have searched a few links in Google but didn't get any suitable solution. Can anyone please help me out?

[FunctionName("MailFailureFucntion")]
public static void Run([TimerTrigger("*/30 * * * *")] TimerInfo myTimer, ILogger log)  
{

 // my code - connecting SQL and send mail

}

Initially I have tried with 0 */2 * * * - 2 Hrs interval. Then I have tried with */30 * * * *

question from:https://stackoverflow.com/questions/65917602/azure-function-time-trigger-is-triggering-only-when-opening-the-azure-portal

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is a cheat sheet for Azure Function Cron Expresion

https://arminreiter.com/2017/02/azure-functions-time-trigger-cron-cheat-sheet/

In your case code may look like(Runs every 2 hours)

public static void Run([TimerTrigger("0 0 */2 * * *")]TimerInfo myTimer, ILogger log)

I would also recommend to check runOnStartup and make sure that is set to false

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=python#configuration


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...