Azure functions 为什么azure函数具有引用旧数据的表?
我有两个azure函数Azure functions 为什么azure函数具有引用旧数据的表?,azure-functions,azure-table-storage,Azure Functions,Azure Table Storage,我有两个azure函数 从表存储中获取新记录(readFunction) 更新第二次更新已处理的表存储(updateFunction) 这两个函数都调用以下函数: public static async Task UpdateMessage(CloudTable table, string partitionKey, string rowKey, JobUpdateStatus updateToStatus) { TableOperation
public static async Task UpdateMessage(CloudTable table, string partitionKey, string rowKey, JobUpdateStatus updateToStatus)
{
TableOperation retrieve = TableOperation.Retrieve<MigrationFeatures>(partitionKey, rowKey);
TableResult result = await table.ExecuteAsync(retrieve);
MigrationFeatures newMigrationData = (MigrationFeatures)result.Result;
if (result != null)
{
var entity = new DynamicTableEntity(newMigrationData.PartitionKey, newMigrationData.RowKey);
entity.ETag = "*";
entity.Timestamp = DateTime.Now;
entity.Properties.Add("JobStatus", new EntityProperty(updateToStatus.ToString()));
var mergeOperation = TableOperation.Merge(entity);
var tableResult = await table.ExecuteAsync(mergeOperation);
var resultUpdate= tableResult.HttpStatusCode; // returns 204
}
}
公共静态异步任务更新消息(CloudTable表、string partitionKey、string rowKey、JobUpdateStatus UpdateStatus)
{
TableOperation retrieve=TableOperation.retrieve(partitionKey,rowKey);
TableResult结果=等待table.ExecuteAsync(检索);
MigrationFeatures newMigrationData=(MigrationFeatures)result.result;
如果(结果!=null)
{
var entity=new DynamicTableEntity(newMigrationData.PartitionKey,newMigrationData.RowKey);
entity.ETag=“*”;
entity.Timestamp=DateTime.Now;
Add(“JobStatus”,新的EntityProperty(updateToStatus.ToString());
var mergeOperation=TableOperation.Merge(实体);
var tableResult=wait table.ExecuteAsync(合并操作);
var resultUpdate=tableResult.HttpStatusCode;//返回204
}
}
现在,我的readFunction查询表存储以获取下一个作业,然后调用上面的函数。
这是第一次从准备到完成。但是,下次再次转到readFunction时,它将拾取原始状态的相同记录,并导致重复该过程
为什么?
更新屏幕截图
[![在此处输入图像描述][1][1]
一旦流程通过第二个功能,流程就进入完成状态,一旦到达第一个功能,数据就会在处理过程中更新
[1] :
更新2:
当使用
Table.Replace
选项而不是Table.Merge
时,数据开始更新,但有一半数据丢失(空值)问题很简单,数据已存储,但未及时复制,以便我读取
添加延迟解决了问题能否提供表格数据的屏幕截图?据我了解,您希望更新一行数据。执行此操作后,该行包含旧数据和新数据。对吗?@JimXu我已经添加了图片,以显示数据。对于你的第二个评论,这是正确的。在我看来,似乎有一个数据缓存或对旧数据的引用被刷新。如果要更新一行的数据并移动不需要的数据,可以使用replace方法:and