如何在Azure表存储操作中重试失败的更新请求(412错误代码)?

时间:2019-04-15 10:29:29

标签: azure concurrency

我正在寻找一种解决方案来处理由于错误代码412而导致的azure表操作中的更新失败。我的应用程序将同时向该表发出更新请求,并且大多数情况下都会因代码412而失败。重试该请求并使其正确。 更新的类型就像是,每个请求都将读取数据并将其与新数据合并并放回去。挑战是,我的应用程序需要在几秒钟内处理大量这样的请求

1 个答案:

答案 0 :(得分:0)

From what you describe using azure table storage I do not think there is any other way than what you are doing already. So either update the ETag and resend the request or else unconditionally overwrite what is there which will cause you lose updates.

In your case I would also experiment with Azure Document Db so you could in theory push that union logic to the server side as a stored procedure which could transparently do the retry on ETag failure. That should be much faster because you would not need to do any I/O request for retries from client side and assume whatever you get back from the db is the latest and the most up to date Boundary entity.