private async Task NotifiyPrometheusSystemStartup() { await Task.Delay(TimeSpan.FromSeconds(1)).ConfigureAwait(false); var environment = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT")) ? "Production" : Environment.GetEnvironmentVariable("DOTNET_ENVIRONMENT"); await discordMessageClient.SendMessageToPrometheus("Chatlisterner started, Discord Client Started").ConfigureAwait(false); await discordMessageClient.SendMessageToPrometheus($"{environment} environment ready to go!").ConfigureAwait(false); }
public async Task Handle(CheckDataFeedCommand message, IMessageHandlerContext context) { if (await chatlistenerService.CheckConnectionAndRestartIfNeeded().ConfigureAwait(false)) { const string logMessage = "Connection problems had been detected, connection has been attempted reset"; logger.LogWarning(logMessage); await discordMessageClient.SendMessageToPrometheus(logMessage).ConfigureAwait(false); } var options = new SendOptions(); options.DelayDeliveryWith(TimeSpan.FromMinutes(30)); options.RouteToThisEndpoint(); await context.Send(new CheckDataFeedCommand(), options).ConfigureAwait(false); logger.LogInformation("Delayed Check Data Feed command has been sent"); }
public async Task Handle(TrainSystemCommand message, IMessageHandlerContext context) { const string logMessage = "Received Train System event... Doing a quick workout! -> We shall be smarter!"; logger.LogInformation(logMessage); await discordMessageClient.SendMessageToPrometheus(logMessage).ConfigureAwait(false); await dataAnalyser.TrainMachineLearningModels().ConfigureAwait(false); await dataAnalyser.AttemptTagUnauditedSuspensions().ConfigureAwait(false); var options = new SendOptions(); options.DelayDeliveryWith(TimeSpan.FromDays(1)); options.RouteToThisEndpoint(); await context.Send(new TrainSystemCommand(), options).ConfigureAwait(false); logger.LogInformation("Delayed Train System command sent"); }