debug yt handler

This commit is contained in:
Adam R. Grey 2021-08-21 01:04:44 -04:00
parent ea06956780
commit cc5efacccc

View File

@ -93,6 +93,13 @@ namespace director
} }
} }
Console.WriteLine("calendars checked"); Console.WriteLine("calendars checked");
#if(DEBUG)
var psuedo = new Schedulable.Schedulable();
psuedo.Showtime = DateTime.Now + TimeSpan.FromSeconds(30);
psuedo.ScedulableType = Schedulable.ScedulableType.YTRelease;
workQueue.Enqueue(psuedo);
_signal.Set();
#endif
} }
private delegate void schedulableCreate(ref Schedulable.Schedulable creating); private delegate void schedulableCreate(ref Schedulable.Schedulable creating);
@ -127,7 +134,8 @@ namespace director
if (!workQueue.TryDequeue(out todo)) { continue; } if (!workQueue.TryDequeue(out todo)) { continue; }
Console.WriteLine($"threadwork consumes! showtime at {todo.Showtime}; napping until {todo.Showtime - conf.preshowBufferTime}"); var napLength = (todo.Showtime - conf.preshowBufferTime) - DateTime.Now;
Console.WriteLine($"threadwork consumes! showtime at {todo.Showtime}; napping until {todo.Showtime - conf.preshowBufferTime} ({napLength})");
switch(todo.ScedulableType) switch(todo.ScedulableType)
{ {
case Schedulable.ScedulableType.TwitchStream: case Schedulable.ScedulableType.TwitchStream:
@ -137,8 +145,10 @@ namespace director
Console.WriteLine("it's a yt release"); Console.WriteLine("it's a yt release");
break; break;
} }
Task.WaitAll(Task.Delay((todo.Showtime - conf.preshowBufferTime) - DateTime.Now)); if(napLength.TotalMinutes > 0)
Console.WriteLine("time to prep!"); {
Task.WaitAll(Task.Delay(napLength));
}
switch (todo.ScedulableType) switch (todo.ScedulableType)
{ {