From bd834fb4d715d47298de1ec06d0174ac5f95a97f Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 4 Dec 2021 18:03:33 -0600 Subject: [PATCH] Fixed: Stats fails to load due to unparsable elapsedTime for history event Fixes #663 --- src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs b/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs index 7bd8cd075..02bbbb143 100644 --- a/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs +++ b/src/NzbDrone.Core/IndexerStats/IndexerStatisticsService.cs @@ -54,8 +54,11 @@ namespace NzbDrone.Core.IndexerStats var sortedEvents = indexer.OrderBy(v => v.Date) .ThenBy(v => v.Id) .ToArray(); + int temp = 0; - indexerStats.AverageResponseTime = (int)sortedEvents.Where(h => h.Data.ContainsKey("elapsedTime")).Select(h => int.Parse(h.Data.GetValueOrDefault("elapsedTime"))).Average(); + indexerStats.AverageResponseTime = (int)sortedEvents.Where(h => int.TryParse(h.Data.GetValueOrDefault("elapsedTime"), out temp)) + .Select(h => temp) + .Average(); foreach (var historyEvent in sortedEvents) {