예제 #1
0
        private async Task <Task> TryStartDiscordReader()
        {
            while (true)
            {
                _discordWebReader = new DiscordWebReader();

                try
                {
                    return(await StartPollDiscordFeed(_discordWebReader.stream));
                }
                catch (WebException)
                {
                    Log.Warn($"Experiencing connection issues. Throttling...");
                    Thread.Sleep(30 * 1000);
                    _discordWebReader.InitializeWebClient();
                }
                catch (Exception e)
                {
                    Log.Warn($"Unknown exception", e);
                    continue;
                }
                finally
                {
                    Thread.Sleep(20 * 1000);
                }
            }
        }
예제 #2
0
        public void Start()
        {
            var settings = GlobalSettings.Load();

            channel_parser.Init();

            if (settings == null)
            {
                return;
            }

            VersionCheckState.Execute(new CancellationToken());

            StartNet(settings.Port);

            PollRarePokemonRepositories(settings);

            var discordWebReader = new DiscordWebReader();

            while (true)
            {
                try
                {
                    pollDiscordFeed(discordWebReader.stream);
                }
                catch (WebException)
                {
                    Log.Warn($"Experiencing connection issues. Throttling...");
                    Thread.Sleep(30 * 1000);
                    discordWebReader.InitializeWebClient();
                }
                catch (Exception e)
                {
                    Log.Warn($"Unknown exception", e);
                    break;
                }
                finally
                {
                    Thread.Sleep(20 * 1000);
                }
            }

            Console.ReadKey(true);
        }
예제 #3
0
        public async void Start()
        {
            var settings = GlobalSettings.Load();
            channel_parser.Init();

            if (settings == null) return;

            StartNet(settings.Port);

            PollRarePokemonRepositories(settings);

            var discordWebReader = new DiscordWebReader();

            while (true)
            {
                try
                {
                    pollDiscordFeed(discordWebReader.stream);
                }
                catch (WebException e)
                {
                    Log.Warn($"Experiencing connection issues. Throttling...");
                    discordWebReader.InitializeWebClient();
                }
                catch (Exception e)
                {
                    Log.Warn($"Unknown exception", e);
                    break;
                }
                finally
                {
                    Thread.Sleep(20 * 1000);
                }
            }

            Console.ReadKey(true);
        }