Skip to content

Commit

Permalink
Fixed the startup delays
Browse files Browse the repository at this point in the history
  • Loading branch information
5andr0 committed Aug 2, 2016
1 parent bec9e69 commit 571b868
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions PogoLocationFeeder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,22 @@ public async void Start()
{
try
{
Thread.Sleep(30 * 1000);
pollDiscordFeed(discordWebReader.stream);
}
catch (WebException e)
{
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);
Expand Down Expand Up @@ -206,12 +208,11 @@ private static IEnumerable<string> ReadLines(StreamReader stream)

private void pollDiscordFeed(Stream stream)
{
int delay = 30 * 1000;
int delay = 10 * 1000;
var cancellationTokenSource = new CancellationTokenSource();
var token = cancellationTokenSource.Token;
Task.Factory.StartNew(async () =>
{
Thread.Sleep(5 * 1000);
while (true)
{
for (int retrys = 0; retrys <= 3; retrys++)
Expand Down

0 comments on commit 571b868

Please sign in to comment.