[FunctionName("SetDurable")]
public static async Task<HttpResponseMessage> SetDurable(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = "SetDurable/{durable}")] HttpRequestMessage req,
[DurableClient] IDurableEntityClient client,
string durable)
{
var entityId = new EntityId(DurableEntitiesNames.BirSessionIdentificatorEntity, DurableEntitiesNames.BirSessionIdentificatorKey);
await client.SignalEntityAsync<IBirSessionIdentificator>(entityId, identificator => identificator.Set(durable) );
//await Task.Delay(2000);
EntityStateResponse<JObject> stateResponse = await client.ReadEntityStateAsync<JObject>(entityId);
var setResult = stateResponse.EntityState.ToObject<BirSessionIdentificatorResult>().Sid;
return new HttpResponseMessage(HttpStatusCode.OK){Content = new StringContent($"{setResult}")};
}
In Azure Functions v3 when i try to set the value of durable entity and then immediately try to read this value, it returns old value instead of the new value. But when i uncomment the Task.Delay and make it wait 2 seconds after setting the value of durable entity i get correct value while trying to read it.
Is there any way to await the completion of durable entity value setting operation?