private async void OnEmailTimerTick(object sender, ElapsedEventArgs e) { try { emailTimer.Stop(); if (emailTickCounter < emailPullInterval) { emailTickCounter++; } else { List <string> buildGroupIDs = Configuration.ReadBuildGroupIDs(); emailPullInterval = Configuration.ReadEmailPullInterval(); bsLogic.Update(buildGroupIDs); Dictionary <string, HashSet <string> > groupIDsForRepositories = Configuration.ReadGroupIDsForRepositories(); //commitLogic.Update(groupIDsForRepositories); commitFileLogic.Update(groupIDsForRepositories); emailTickCounter = 0; } } finally { emailTimer.Start(); } }
private async void OnEmailTimerTick(object sender, ElapsedEventArgs e) { try { emailTimer.Stop(); if (emailTickCounter < emailPullInterval) { emailTickCounter++; } else { //List<string> buildGroupIDs = Configuration.ReadBuildGroupIDs(); emailPullInterval = Configuration.ReadEmailPullInterval(); //bsLogic.Update(buildGroupIDs); //List<string> commitGroupIDs = Configuration.ReadCommitGroupIDs(); Dictionary <string, HashSet <string> > groupIDsForRepositories = Configuration.ReadGroupIDsForRepositories(); //commitLogic.Update(groupIDsForRepositories); commitFileLogic.Update(groupIDsForRepositories); emailTickCounter = 0; } if (slRuntimeApiClient.IsOpen()) { MethodInvoker invoker = new MethodInvoker(() => slWebsocketStatusLabel.BackColor = Color.Green); slWebsocketStatusLabel.Invoke(invoker); } else if (slRuntimeApiClient.IsConnecting()) { MethodInvoker invoker = new MethodInvoker(() => slWebsocketStatusLabel.BackColor = Color.Yellow); slWebsocketStatusLabel.Invoke(invoker); } else { // Slack limits rate of API request to 1 second. // This may cause fails due to error 429. // Let's try to authenticate each 5 seconds. if ((almTickCounter % cSlRuntimeRetryInterval) == 0) { slRuntimeApiClient.Authenticate(); } } UpdateEmailUI(); } finally { emailTimer.Start(); } }