AppVeyor.UI.Model.Repository.UpdatePollingInterval C# (CSharp) Method

UpdatePollingInterval() public method

public UpdatePollingInterval ( System.TimeSpan currentPollDuration, List projects, bool isPollingCancelled ) : System.TimeSpan
currentPollDuration System.TimeSpan
projects List
isPollingCancelled bool
return System.TimeSpan
        public TimeSpan UpdatePollingInterval(TimeSpan currentPollDuration, List<Project> projects, bool isPollingCancelled)
        {
            var newPollDuration = currentPollDuration;

            if (projects.Any(p => p.Builds.Any(b => string.IsNullOrEmpty(b.Finished))))
                newPollDuration = TimeSpan.FromSeconds(5);

            if (projects.Any(p => p.Builds.Any(b => !string.IsNullOrEmpty(b.Finished))))
                newPollDuration = TimeSpan.FromSeconds(30);

            if (isPollingCancelled)
                newPollDuration = TimeSpan.FromSeconds(10);

            return newPollDuration;
        }