public override async Task Execute() { await base.Execute(); var cfg = _configProvider.GitCfg; Logger.Log($"Checking for updates in project: {cfg.ProjectName}, on branch {cfg.Branch}"); while (CurrentState == ProcessState.Executing) { var last = _dataContainer.LastQuery; var next = last.AddSeconds(cfg.TimePollSeconds); if (DateTime.Now >= next) { _dataContainer.LastQuery = DateTime.Now; bool b = await Validate(); if (!b) { return; } var response = await _gitService.QueryLatestCommit(); if (response.Success) { var hasChanged = _buildService.HasBranchBeenUpdated(response.Hash); if (hasChanged) { Console.WriteLine($"\n{response}"); Logger.Log($"Change on branch detected."); _buildService.SetWorkingBuild(response); Complete(); } } } else { var time = next - DateTime.Now; var t = BuildService.GetTimeFormat(time); var lastTime = _dataContainer.LastQuery.ToShortTimeString(); Console.Write($"\rLast query: {lastTime} - Checking for update in: {t}"); await Task.Delay(1000); } } }