Skip to content

Commit

Permalink
More logging
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan committed May 23, 2024
1 parent 84151be commit e3fc671
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Runner/JobBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,27 @@ private async Task ReadChannelAsync()
{
try
{
TimeSpan lastElapsed = TimeSpan.Zero;
while (!Volatile.Read(ref completed))
{
await Task.Delay(100, JobTimeout);
TimeSpan elapsed;
lock (_lastLogEntry)
{
if (_lastLogEntry.Elapsed.TotalSeconds < 2 * 60)
{
continue;
}
elapsed = _lastLogEntry.Elapsed;
}
if (elapsed.TotalSeconds > 30 && elapsed > lastElapsed + TimeSpan.FromSeconds(30))
{
Console.WriteLine($"Idle for {elapsed.TotalSeconds} seconds");
lastElapsed = elapsed;
}
if (elapsed.TotalSeconds < 2 * 60)
{
continue;
}
await LogAsync("Heartbeat - I'm still here");
Expand Down

0 comments on commit e3fc671

Please sign in to comment.