0
我的问题类似于下面的问题。当webjob关闭时更新存储表
Notification of when continuous Azure WebJob is stopping for NoAutomaticTrigger type jobs
我已经使用这个想法从Amit's Blog但随后打了一个小障碍
我有,如果webjob是从门户网站关闭其被触发的webjob文件观察者集。
我需要在webjob终止之前更新存储表中的几个标志。
问题是,我的代码似乎停止在一个点,我试图从存储表中检索记录。我在下面的代码周围有异常处理程序,控制台上没有写入异常消息。
下面是我的代码
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("my storage key");
var tableClient = storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("myTable");
TableOperation operation = TableOperation.Retrieve("partKey", "rowKey");
var result = table.Execute(operation); // stucks here
if (result.Result != null)
{
MyEntity entity = (MyEntity)result.Result;
if (entity != null)
{
entity.IsRunning = false; //reset the flag
TableOperation update = TableOperation.InsertOrReplace(entity);
table.Execute(update); //update the record
}
}
我在settings.job
为300秒增加stopping_wait_time
但仍没有运气。