-
Notifications
You must be signed in to change notification settings - Fork 361
Open
Labels
kind/bugSomething isn't workingSomething isn't working
Milestone
Description
Describe the proposal
Currently, the SDK allows you to make the following call:
await daprClient.SaveStateAsync<Foo>(
"storename",
"key",
new Foo(),
new StateOptions
{
Concurrency = ConcurrencyMode.FirstWrite
});The problem with the call is that we're asking Dapr to do something impossible. FirstWrite OCC will only work if we send an ETag along with the request. SaveStateAsync will never send the ETag, for that you need to call TrySaveStateAsync.
The call will succeed but it won't use FirstWrite OCC. There are other situations where you can give Dapr state management a command/hint that cannot be fulfilled by the underlying state store, such as asking for strong consistency if the data store doesn't support it. However, the FirstWrite issue can be caught early at the SDK level.
I propose throwing an exception with a clear message explaining that you need ETag/TrySaveState to use FirstWrite.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working