Пример #1
0
 public TicketService
 (
     IGrpcServiceFactory grpcServiceFactory,
     IGmailService gmailService,
     IDiscordService discordService,
     ITicketHubConnections ticketHubConnections,
     IHostingEnvironment env
 )
 {
     _isDev                = env.EnvironmentName.Contains("Dev");
     _gmailService         = gmailService;
     _ticketServiceClient  = grpcServiceFactory.GetTicketSercviceClient();
     _discordService       = discordService;
     _ticketHubConnections = ticketHubConnections;
 }
Пример #2
0
        public async Task <Dictionary <string, object> > CheckStatusOnGrpcServices()
        {
            var dict = new Dictionary <string, object>();

            var discordTimeTask = Ping(() => _grpcServiceFactory.GetDiscordSercviceClient().PingAsync());
            var historyTimeTask = Ping(() => _grpcServiceFactory.GetHistorySercviceClient().PingAsync());
            var chatTimeTask    = Ping(() => _grpcServiceFactory.GetChatSercviceClient().PingAsync());
            var steamTimeTask   = Ping(() => _grpcServiceFactory.GetSteamServiceClient(new SteamInventoryCacheManager()).PingAsync());
            var ticketTimeTask  = Ping(() => _grpcServiceFactory.GetTicketSercviceClient().PingAsync());

            await Task.WhenAll(chatTimeTask, discordTimeTask, historyTimeTask, steamTimeTask, ticketTimeTask);

            dict.Add("Discord", discordTimeTask.Result);
            dict.Add("History", historyTimeTask.Result);
            dict.Add("Chat", chatTimeTask.Result);
            dict.Add("steam", steamTimeTask.Result);
            dict.Add("ticket", ticketTimeTask.Result);

            return(dict);
        }