本文介绍了当预定WebJob长时间运行会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果一个蓝色的WebJob计划运行,但previous运行实例尚未完成,会发生什么?将它这样两个同时运行再次运行WebJob?这不是要运行WebJob并启动时钟结束了吗?我一直没能找到这种行为在任何地方记录。我有工作我要每小时运行,但它可能是有时可能需要一个多小时才能完成更长的时间,但我从来没有想他们两个同时运行。

What happens if an Azure WebJob is scheduled to run but the previous running instance hasn't finished yet? Will it run the WebJob again so that two are running at once? Will it not run the WebJob and start the clock over? I haven't been able to find this behavior documented anywhere. I have a job I want to run hourly but it's possible that sometimes it might take longer than an hour to complete, but I never want two of them running at once.

推荐答案

据我了解计划webjobs只是触发正在使用Azure的调度运行webjobs,如果您​​打开Azure的调度管理门户可以看到webjobs甚至配置它们在更多的细节。 (你可以看到日志过这将使您简单回答你的问题)。

As i understand it scheduled webjobs is just triggered webjobs that is run using Azure Scheduler, if you open Azure Scheduler in management portal you can see the webjobs and even configure them in more detail. (You can see the log too which would give you the simple answer to your question).

如果你想看看怎么回事你的计划webjob运行由捻触发webjob,如果在库杜源看,你会看到,当一个作业开始创建一个锁文件,如果你尝试再掀工作,如果已经有一个锁文件一个ConflictException被抛出

If you like to look at whats going on your scheduled webjob is run as a Triggered webjob by Kudu, if you look in the Kudu source you will see that a lockfile is created when a job is started, and if you try to start another job a ConflictException is thrown if there is already a lock file

Azure的调度使用网络挂接调用你的工作是捕捉ConflictException并为您提供了Error_WebJobAlreadyRunning警告它会告诉你:无法启动,因为工作已经在运行一个新的运行

The Azure scheduler calls your job using a webhook that catches the ConflictException and gives you the "Error_WebJobAlreadyRunning" warning which will tell you: "Cannot start a new run since job is already running."

这篇关于当预定WebJob长时间运行会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:28