Skip to content

Handling failures of WriteStateAsync #8050

Answered by ReubenBond
juho-hanhimaki asked this question in Q&A
Discussion options

You must be logged in to vote

What you're suggesting makes sense. One option is to copy the state before modification using DeepCopier/DeepCopier<T> (which you can inject) so that you can restore it after a failed update attempt. A potentially cheaper alternative is to set a dirty flag and to ensure that state is reloaded from storage if the flag is set when necessary. You can implement that using IIncomingGrainCallFilter or by wrapping the state type in your own type which manages the flag.

This strange event sourcing toy uses the approach of deactivating the grain if it has a storage error: https://github.com/ReubenBond/OrleansEventJournal/blob/8fc000c469bb1aba58b9c9497877362093911e6c/EventJournal/JournaledActor.cs#…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@juho-hanhimaki
Comment options

@juho-hanhimaki
Comment options

@ReubenBond
Comment options

@juho-hanhimaki
Comment options

@juho-hanhimaki
Comment options

Answer selected by juho-hanhimaki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants