Don't block task queue for queued update task when there are longer running tasks executing
This commit is contained in:
parent
762042ba97
commit
1f14276770
|
@ -5,5 +5,7 @@ namespace NzbDrone.Core.Download
|
|||
public class ProcessMonitoredDownloadsCommand : Command
|
||||
{
|
||||
public override bool RequiresDiskAccess => true;
|
||||
|
||||
public override bool IsLongRunning => true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
{
|
||||
public class RssSyncCommand : Command
|
||||
{
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public override bool IsLongRunning => true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace NzbDrone.Core.Messaging.Commands
|
|||
public virtual string CompletionMessage => "Completed";
|
||||
public virtual bool RequiresDiskAccess => false;
|
||||
public virtual bool IsExclusive => false;
|
||||
public virtual bool IsLongRunning => false;
|
||||
|
||||
public string Name { get; private set; }
|
||||
public DateTime? LastExecutionTime { get; set; }
|
||||
|
|
|
@ -164,13 +164,24 @@ namespace NzbDrone.Core.Messaging.Commands
|
|||
{
|
||||
// If an executing command requires disk access don't return a command that
|
||||
// requires disk access. A lower priority or later queued task could be returned
|
||||
// instead, but that will allow other tasks to execute whiule waiting for disk access.
|
||||
// instead, but that will allow other tasks to execute while waiting for disk access.
|
||||
if (startedCommands.Any(x => x.Body.RequiresDiskAccess))
|
||||
{
|
||||
return c.Status == CommandStatus.Queued &&
|
||||
!c.Body.RequiresDiskAccess;
|
||||
}
|
||||
|
||||
// If an executing command is long running then skip any exclusive commands until
|
||||
// they complete. A lower priority or later queued task could be returned
|
||||
// instead, but that will allow other tasks to execute while waiting for exclusive
|
||||
// execution.
|
||||
|
||||
if (startedCommands.Any(x => x.Body.IsLongRunning))
|
||||
{
|
||||
return c.Status == CommandStatus.Queued &&
|
||||
!c.Body.IsExclusive;
|
||||
}
|
||||
|
||||
return c.Status == CommandStatus.Queued;
|
||||
})
|
||||
.OrderByDescending(c => c.Priority)
|
||||
|
|
|
@ -20,5 +20,7 @@ namespace NzbDrone.Core.Tv.Commands
|
|||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public override bool UpdateScheduledTask => !SeriesId.HasValue;
|
||||
|
||||
public override bool IsLongRunning => true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue