Exemplo n.º 1
0
        private void StartMainBuildsRetrieverThread()
        {
            var branches     = ReadAppSetting("BranchList");
            var sleepTime    = TimeSpan.FromMilliseconds(Convert.ToInt32(ReadAppSetting("SleepTimeMilliSeconds")));
            var buildsFilter = new FilterBuildsWeNeedToUpdate();

            Logger.Info("Starting the builds retrieving thread:");
            Thread thread = new Thread(() => StartFailedBuildsRetrieverLoop(branches, sleepTime, buildsFilter))
            {
                IsBackground = true
            };

            thread.Start();
        }
Exemplo n.º 2
0
        private void StartFailedBuildsRetrieverLoop(string branches, TimeSpan sleepTime, FilterBuildsWeNeedToUpdate buildsFilter)
        {
            while (true)
            {
                m_SpeedUpTc.Resume();
                var failedBuilds = m_FailedBuildsRetriever.GetFailedBuilds(branches);
                m_SpeedUpTc.Pause();

                var failedBuildsInDb = new HashSet <string>(m_DbManager.GetFailedBuildsNames());
                var newFailedBuilds  = failedBuilds.Where(failedBuild => !failedBuildsInDb.Contains(failedBuild.BuildType.Id)).ToArray();
                var oldFailedBuilds  = failedBuilds.Where(failedBuild => failedBuildsInDb.Contains(failedBuild.BuildType.Id)).ToArray();

                var newFailedBuildsWithOneResponsible = buildsFilter.FindResponsible(newFailedBuilds);
                var buildsIdsSentSuccessfully         = SendEmailsToResponsiblesAndGetBuildsIdsToUpdate(newFailedBuildsWithOneResponsible);
                var oldFailedBuildsIds = GetFailedBulidsIdsThatAreAlreadyInDb(oldFailedBuilds, buildsIdsSentSuccessfully);

                m_DbManager.UpdateFailedBuilds(oldFailedBuildsIds);


                Thread.Sleep(sleepTime);
            }
        }