From 79b2fad6e37ab27903dc6477359df1a1afe778cc Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 4 Aug 2011 21:49:18 -0700 Subject: [PATCH] Removing items from job queue is now done while a lock is acquired. --- NzbDrone.Core/Providers/Jobs/JobProvider.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Core/Providers/Jobs/JobProvider.cs b/NzbDrone.Core/Providers/Jobs/JobProvider.cs index 7715bfcd3..d17aab47a 100644 --- a/NzbDrone.Core/Providers/Jobs/JobProvider.cs +++ b/NzbDrone.Core/Providers/Jobs/JobProvider.cs @@ -1,4 +1,5 @@ -using System; +//https://github.com/kayone/NzbDrone/blob/master/NzbDrone.Core/Providers/Jobs/JobProvider.cs +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -201,6 +202,7 @@ namespace NzbDrone.Core.Providers.Jobs if (Queue.Count != 0) { job = Queue.First(); + Queue.Remove(job); } } @@ -214,13 +216,6 @@ namespace NzbDrone.Core.Providers.Jobs { Logger.FatalException("An error has occurred while processing queued job.", e); } - finally - { - if (job != null) - { - Queue.Remove(job); - } - } } } while (Queue.Count != 0);