部署后立即触发的时间触发天蓝色功能 [英] Time triggered azure function to trigger immediately after deploy

查看:16
本文介绍了部署后立即触发的时间触发天蓝色功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个时间触发的 Azure 功能,每 1 小时触发一次.我的要求是,它应该每小时触发一次,但也应该在部署后立即触发一次?使用 cron 表达式是我唯一的方法吗?

I have a time-triggered azure function triggered every 1 hour. My requirement is that, it should get triggered every hour but once also immediately after the deployment ? Is playing with cron expression my only way for this ?

推荐答案

与部署没有直接关系.runOnStartup 设置,记录在 这里,在运行时启动时触发您的函数,但不会导致运行时因部署而启动.

There isn't something directly tied to the deployment. The runOnStartup setting, documented here, triggers your function when the runtime starts, but won't cause the runtime to start as a result of a deployment.

您最好的选择可能是自定义您的部署,如 在此处记录,并在部署完成后调用您的函数(通过发出 HTTP 请求).您可以共享代码并拥有一个 HTTP 触发函数,该函数使用与按计划运行的计时器函数相同的逻辑.

Your best option would likely be to customize your deployment, as documented here, and invoke your function (by issuing an HTTP request) once the deployment completes. You can share the code and have an HTTP triggered function that uses the same logic as the timer function that runs on a schedule.

这篇关于部署后立即触发的时间触发天蓝色功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆