Skip to content

Commit 89d9633

Browse files
committed
Make some logging changes for diagnostic purposes
1 parent 2cd0f6e commit 89d9633

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Hangfire.Redis.StackExchange/ExpiredJobsWatcher.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Linq;
45
using System.Threading;
56
using System.Threading.Tasks;
@@ -54,7 +55,7 @@ void IServerComponent.Execute(CancellationToken cancellationToken)
5455
var count = redis.ListLength(redisKey);
5556
if (count == 0) continue;
5657

57-
Logger.InfoFormat("Removing expired records from the '{0}' list...", key);
58+
Logger.DebugFormat("Removing expired records from the '{0}' list...", key);
5859

5960
const int batchSize = 100;
6061
var keysToRemove = new List<string>();
@@ -82,7 +83,7 @@ void IServerComponent.Execute(CancellationToken cancellationToken)
8283

8384
if (keysToRemove.Count == 0) continue;
8485

85-
Logger.InfoFormat("Removing {0} expired jobs from '{1}' list...", keysToRemove.Count, key);
86+
Logger.Info($"Removing {keysToRemove.Count} expired jobs from '{key}' list...");
8687

8788
using (var transaction = connection.CreateWriteTransaction())
8889
{
@@ -96,7 +97,13 @@ void IServerComponent.Execute(CancellationToken cancellationToken)
9697
}
9798
}
9899

100+
var watch = Stopwatch.StartNew();
99101
cancellationToken.WaitHandle.WaitOne(_checkInterval);
102+
watch.Stop();
103+
if (watch.Elapsed < _checkInterval)
104+
{
105+
Logger.Warn($"Waited for '{watch.Elapsed}' which was less than the check interval of '{_checkInterval}'");
106+
}
100107
}
101108
}
102109
}

0 commit comments

Comments
 (0)