diff --git a/Program.cs b/Program.cs index 0d7fb2b..fe8fc2f 100644 --- a/Program.cs +++ b/Program.cs @@ -93,6 +93,13 @@ namespace director } } 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); @@ -127,7 +134,8 @@ namespace director 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) { case Schedulable.ScedulableType.TwitchStream: @@ -137,8 +145,10 @@ namespace director Console.WriteLine("it's a yt release"); break; } - Task.WaitAll(Task.Delay((todo.Showtime - conf.preshowBufferTime) - DateTime.Now)); - Console.WriteLine("time to prep!"); + if(napLength.TotalMinutes > 0) + { + Task.WaitAll(Task.Delay(napLength)); + } switch (todo.ScedulableType) {