Exemple #1
0
 public ChatService
 (
     IRepoServiceFactory repoServiceFactory,
     IGrpcServiceFactory grpcServiceFactory,
     IChatHubConnections chatHubConnections,
     ISettingsService settingsService,
     IStaffService staffService,
     IDiscordService discordService
 )
 {
     _repoServiceFactory = repoServiceFactory;
     _chatServiceClient  = grpcServiceFactory.GetChatSercviceClient();
     _chatHubConnections = chatHubConnections;
     _settingsService    = settingsService;
     _staffService       = staffService;
     _discordService     = discordService;
 }
Exemple #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);
        }