mirror of https://github.com/dapr/dotnet-sdk.git
Only isolate state when using reentrancy (#723)
Non-reentrant actors can utilize their state manager's cache for repeated calls. They should still be able to do this unless using reentrancy. Co-authored-by: Ryan Nowak <nowakra@gmail.com>
This commit is contained in:
parent
56ac2431b0
commit
5e544a687a
|
|
@ -339,10 +339,13 @@ namespace Dapr.Actors.Runtime
|
|||
T retval;
|
||||
try
|
||||
{
|
||||
// Set the state context of the request, if possible.
|
||||
if (state.Actor.StateManager is IActorContextualState contextualStateManager)
|
||||
// Set the state context of the request, if required and possible.
|
||||
if (ActorReentrancyContextAccessor.ReentrancyContext != null)
|
||||
{
|
||||
await contextualStateManager.SetStateContext(Guid.NewGuid().ToString());
|
||||
if (state.Actor.StateManager is IActorContextualState contextualStateManager)
|
||||
{
|
||||
await contextualStateManager.SetStateContext(Guid.NewGuid().ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// invoke the function of the actor
|
||||
|
|
|
|||
Loading…
Reference in New Issue