diff --git a/src/Exceptionless/Extensions/FileStorageExtensions.cs b/src/Exceptionless/Extensions/FileStorageExtensions.cs index cf103d90..a3325743 100644 --- a/src/Exceptionless/Extensions/FileStorageExtensions.cs +++ b/src/Exceptionless/Extensions/FileStorageExtensions.cs @@ -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); }