diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs index bfa4fe944..05c3db63c 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller; namespace MediaBrowser.Server.Implementations.ScheduledTasks { @@ -17,13 +18,16 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks /// private readonly ILibraryManager _libraryManager; + private readonly IServerApplicationHost _appHost; + /// /// Initializes a new instance of the class. /// /// The library manager. - public PeopleValidationTask(ILibraryManager libraryManager) + public PeopleValidationTask(ILibraryManager libraryManager, IServerApplicationHost appHost) { _libraryManager = libraryManager; + _appHost = appHost; } /// @@ -32,9 +36,12 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks /// IEnumerable{BaseTaskTrigger}. public IEnumerable GetDefaultTriggers() { + // Randomize the default start hour because this operation can really hammer internet metadata providers + var startHour = new Random(_appHost.SystemId.GetHashCode()).Next(0, 8); + return new ITaskTrigger[] { - new DailyTrigger { TimeOfDay = TimeSpan.FromHours(3) }, + new DailyTrigger { TimeOfDay = TimeSpan.FromHours(startHour) }, }; }