示例#1
0
文件: CRAWorker.cs 项目: 6bee/CRA
        private async Task RestoreConnections(VertexInfo _row)
        {
            // Decide what to do if connection creation fails
            var outRows = await _connectionInfoProvider.GetAllConnectionsFromVertex(_row.VertexName);

            foreach (var row in outRows)
            {
                await RetryRestoreConnection(row.FromVertex, row.FromEndpoint, row.ToVertex, row.ToEndpoint, false);
            }

            var inRows = await _connectionInfoProvider.GetAllConnectionsFromVertex(_row.VertexName);

            foreach (var row in inRows)
            {
                await RetryRestoreConnection(row.FromVertex, row.FromEndpoint, row.ToVertex, row.ToEndpoint, true);
            }
        }
示例#2
0
        private async Task RestoreConnections(VertexInfo _row)
        {
            // Decide what to do if connection creation fails
            var outRows = await _connectionInfoProvider.GetAllConnectionsFromVertex(_row.VertexName);

            var outQueue = new Queue <VertexConnectionInfo>();

            foreach (var row in outRows)
            {
                outQueue.Enqueue(row);
            }

            var inRows = await _connectionInfoProvider.GetAllConnectionsToVertex(_row.VertexName);

            var inQueue = new Queue <VertexConnectionInfo>();

            foreach (var row in inRows)
            {
                inQueue.Enqueue(row);
            }

            while (outQueue.Count > 0 || inQueue.Count > 0)
            {
                if (outQueue.Count > 0)
                {
                    var row  = outQueue.Dequeue();
                    var task = RetryRestoreConnection(row.FromVertex, row.FromEndpoint, row.ToVertex, row.ToEndpoint, false, _parallelConnect);
                    if (!_parallelConnect)
                    {
                        bool done = await task;
                        if (!done)
                        {
                            outQueue.Enqueue(row);
                        }
                    }
                }

                if (inQueue.Count > 0)
                {
                    var row  = inQueue.Dequeue();
                    var task = RetryRestoreConnection(row.FromVertex, row.FromEndpoint, row.ToVertex, row.ToEndpoint, true, _parallelConnect);
                    if (!_parallelConnect)
                    {
                        bool done = await task;
                        if (!done)
                        {
                            inQueue.Enqueue(row);
                        }
                    }
                }
            }
        }
示例#3
0
 internal Task <IEnumerable <VertexConnectionInfo> > GetConnectionsFromVertex(string vertexName)
 => _connectionProvider.GetAllConnectionsFromVertex(vertexName);