Streams have 60 second delay after starting up, refresh every 60 seconds

This commit is contained in:
Kwoth 2016-09-05 21:19:08 +02:00
parent 3e06c64765
commit d8182a663a

View File

@ -18,8 +18,11 @@ namespace NadekoBot.Modules.Searches.Commands
public StreamNotifications(DiscordModule module) : base(module) public StreamNotifications(DiscordModule module) : base(module)
{ {
//start checking only after ready, because we need all servers to be initialized //start checking only after ready, because we need all servers to be initialized
NadekoBot.OnReady += () => Task.Run(async () => NadekoBot.OnReady += () =>
{ {
Task.Run(async () =>
{
await Task.Delay(60000);
while (true) while (true)
{ {
cachedStatuses.Clear(); cachedStatuses.Clear();
@ -80,12 +83,13 @@ namespace NadekoBot.Modules.Searches.Commands
catch { } catch { }
finally finally
{ {
await Task.Delay(TimeSpan.FromSeconds(15)); await Task.Delay(TimeSpan.FromSeconds(60));
} }
} }
}); });
}
};
}
private async Task<Tuple<bool, string>> GetStreamStatus(StreamNotificationConfig stream, bool checkCache = true) private async Task<Tuple<bool, string>> GetStreamStatus(StreamNotificationConfig stream, bool checkCache = true)
{ {
bool isLive; bool isLive;