Ejemplo n.º 1
0
        public Task EnsureTasksHaveOwnership()
        {
            var healthChecks = allPeers().Select(x => x.CheckStatusOfOwnedTasks().ContinueWith(_ => {
                return(new { Peer = x, Response = _.Result });
            }));

            return(Task.WhenAll(healthChecks).ContinueWith(checks => {
                var planner = new TaskHealthAssignmentPlanner(_permanentTasks);
                checks.Result.Each(_ => planner.Add(_.Peer, _.Response));

                var corrections = planner.ToCorrectionTasks(this);

                return Task.WhenAll(corrections).ContinueWith(_ => {
                    _logger.Info(() => "Finished running task health monitoring on node " + NodeId);
                }, TaskContinuationOptions.AttachedToParent);
            }, TaskContinuationOptions.AttachedToParent));
        }
        public Task EnsureTasksHaveOwnership()
        {
            var healthChecks = allPeers().Select(x => x.CheckStatusOfOwnedTasks().ContinueWith(_ => {
                return new {Peer = x, Response = _.Result};
            }));

            return Task.WhenAll(healthChecks).ContinueWith(checks => {
                var planner = new TaskHealthAssignmentPlanner(_permanentTasks);
                checks.Result.Each(_ => planner.Add(_.Peer, _.Response));

                var corrections = planner.ToCorrectionTasks(this);

                return Task.WhenAll(corrections).ContinueWith(_ => {

                    _logger.Info(() => "Finished running task health monitoring on node " + NodeId);

                }, TaskContinuationOptions.AttachedToParent);
            }, TaskContinuationOptions.AttachedToParent);
        }