mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Command queue
New: Adding multiple series will queue them instead of running all at once New: Slower scheduled tasks won't be block others from running
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Jobs
|
||||
{
|
||||
public interface IScheduledTaskRepository : IBasicRepository<ScheduledTask>
|
||||
{
|
||||
ScheduledTask GetDefinition(Type type);
|
||||
void SetLastExecutionTime(int id, DateTime executionTime);
|
||||
}
|
||||
|
||||
public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository
|
||||
{
|
||||
|
||||
public ScheduledTaskRepository(IDatabase database, IEventAggregator eventAggregator)
|
||||
: base(database, eventAggregator)
|
||||
{
|
||||
}
|
||||
|
||||
public ScheduledTask GetDefinition(Type type)
|
||||
{
|
||||
return Query.Where(c => c.TypeName == type.FullName).Single();
|
||||
}
|
||||
|
||||
public void SetLastExecutionTime(int id, DateTime executionTime)
|
||||
{
|
||||
var task = new ScheduledTask
|
||||
{
|
||||
Id = id,
|
||||
LastExecution = executionTime
|
||||
};
|
||||
|
||||
SetFields(task, scheduledTask => scheduledTask.LastExecution);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user