From e9b344ec85ae9fb6bd2640aacd57a9ecc431d168 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Fri, 11 Nov 2016 10:59:21 -0600 Subject: [PATCH] Some cleanup --- src/Exceptionless/Extensions/FileStorageExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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); }