Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Nov 11, 2016
1 parent 1c9e8b4 commit e9b344e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Exceptionless/Extensions/FileStorageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ public static bool ReleaseFile(this IObjectStorage storage, ObjectInfo info) {

public static void ReleaseStaleLocks(this IObjectStorage storage, string queueName, TimeSpan? maxLockAge = null) {
if (!maxLockAge.HasValue)
maxLockAge = TimeSpan.FromMinutes(60);
maxLockAge = TimeSpan.FromHours(1);

foreach (var file in storage.GetObjectList(Path.Combine(queueName, "q", "*.x"), 500).ToList().Where(f => f.Modified < DateTime.Now.Subtract(maxLockAge.Value)))
var files = storage.GetObjectList(Path.Combine(queueName, "q", "*.x"), 500).ToList();
foreach (var file in files.Where(f => f.Modified < DateTime.Now.Subtract(maxLockAge.Value)))
storage.ReleaseFile(file);
}

Expand Down

0 comments on commit e9b344e

Please sign in to comment.