0

このエンティティがサーバーの要求によって毎秒何度も更新される場合、エンティティの更新を最適化するにはどうすればよいですか? 更新に使用される方法は、次のように開発されています。

public async Task<bool> Update(T entity, string key)
    {
        try
        {
            MakeConnection();
            var trans = _db.BeginTransaction();
            var type = typeof(T);
            var keyFactory = _db.CreateKeyFactory(type.Name);
            var task = trans.Lookup(keyFactory.CreateKey(key));
            if (task != null)
            {
                _cache.KeyCache[type.Name] = _db.CreateKeyFactory(type.Name);
                var entities = _mapper.Map<Entity>(entity);
                task = entities;
                trans.Update(task);
            }
            await trans.CommitAsync();
        }
        catch (Exception e)
        {
            throw new InvalidOperationException($"An error occurred, {e}");
        }
        return true;
    }

これはエラーです:

InvalidOperationException: エラーが発生しました, Grpc.Core.RpcException: Status(StatusCode=Aborted, Detail="too much contention on these datastore entities. Please try again. entity groups: [(app=p~******** 、*********、"76fcb9c1-009e-****-b54f-68a45e9c****")]")

4

1 に答える 1