From 486ec14ca81479707798da6c796d277869fe526a Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 7 Jan 2023 12:58:10 -0600 Subject: [PATCH] Check for nullable last activity list sync (cherry picked from commit 4a740acb801a04bc2ead45d272d493f4ec46f7e8) --- .../ImportLists/FetchAndParseImportListService.cs | 4 ++-- src/NzbDrone.Core/ImportLists/ImportListStatus.cs | 2 +- src/NzbDrone.Core/ImportLists/ImportListStatusService.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs b/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs index 19e353976..e77335531 100644 --- a/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs +++ b/src/NzbDrone.Core/ImportLists/FetchAndParseImportListService.cs @@ -49,7 +49,7 @@ namespace NzbDrone.Core.ImportLists var importListLocal = importList; var importListStatus = _importListStatusService.GetLastSyncListInfo(importListLocal.Definition.Id); - if (DateTime.UtcNow < (importListStatus + importListLocal.MinRefreshInterval)) + if (importListStatus.HasValue && DateTime.UtcNow < importListStatus + importListLocal.MinRefreshInterval) { _logger.Trace("Skipping refresh of Import List {0} due to minimum refresh inverval", importListLocal.Definition.Name); continue; @@ -102,7 +102,7 @@ namespace NzbDrone.Core.ImportLists var importListStatus = _importListStatusService.GetLastSyncListInfo(importList.Definition.Id); - if (DateTime.UtcNow < (importListStatus + importList.MinRefreshInterval)) + if (importListStatus.HasValue && DateTime.UtcNow < importListStatus + importList.MinRefreshInterval) { _logger.Trace("Skipping refresh of Import List {0} due to minimum refresh inverval", importList.Definition.Name); return result; diff --git a/src/NzbDrone.Core/ImportLists/ImportListStatus.cs b/src/NzbDrone.Core/ImportLists/ImportListStatus.cs index 69892e1b5..90efc387b 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListStatus.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListStatus.cs @@ -6,6 +6,6 @@ namespace NzbDrone.Core.ImportLists { public class ImportListStatus : ProviderStatusBase { - public DateTime LastInfoSync { get; set; } + public DateTime? LastInfoSync { get; set; } } } diff --git a/src/NzbDrone.Core/ImportLists/ImportListStatusService.cs b/src/NzbDrone.Core/ImportLists/ImportListStatusService.cs index e543d0a7e..bbef4b179 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListStatusService.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListStatusService.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.ImportLists { public interface IImportListStatusService : IProviderStatusServiceBase { - DateTime GetLastSyncListInfo(int importListId); + DateTime? GetLastSyncListInfo(int importListId); void UpdateListSyncStatus(int importListId); } @@ -20,7 +20,7 @@ namespace NzbDrone.Core.ImportLists { } - public DateTime GetLastSyncListInfo(int importListId) + public DateTime? GetLastSyncListInfo(int importListId) { return GetProviderStatus(importListId).LastInfoSync; }