示例#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 async void Start()
        {
            var settings = GlobalSettings.Load();

            channel_parser.Init();

            if (settings == null)
            {
                return;
            }

            StartNet(settings.Port);

            PollRarePokemonRepositories(settings);
            DiscordWebReader discordWebReader = null;

            while (true)
            {
                try {
                    discordWebReader = new DiscordWebReader();
                    if (discordWebReader == null || discordWebReader.stream == null)
                    {
                        Thread.Sleep(30 * 1000);
                        continue;
                    }
                }catch (Exception e)
                {
                    Thread.Sleep(30 * 1000);
                    continue;
                }

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

            Console.ReadKey(true);
        }
示例#3
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);
        }
        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);
        }