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
但仍沒有運氣。