mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Converted jobs to dynamic
This commit is contained in:
parent
93402f4932
commit
a4dde81ceb
42 changed files with 166 additions and 170 deletions
|
@ -143,13 +143,12 @@ namespace NzbDrone.Core.Jobs
|
|||
logger.Trace("{0} Scheduled tasks have been added to the queue", pendingJobTypes.Count);
|
||||
}
|
||||
|
||||
public virtual void QueueJob(Type jobType, int targetId = 0, int secondaryTargetId = 0, JobQueueItem.JobSourceType source = JobQueueItem.JobSourceType.User)
|
||||
public virtual void QueueJob(Type jobType, dynamic options = null, JobQueueItem.JobSourceType source = JobQueueItem.JobSourceType.User)
|
||||
{
|
||||
var queueItem = new JobQueueItem
|
||||
{
|
||||
JobType = jobType,
|
||||
TargetId = targetId,
|
||||
SecondaryTargetId = secondaryTargetId,
|
||||
Options = options,
|
||||
Source = source
|
||||
};
|
||||
|
||||
|
@ -270,7 +269,7 @@ namespace NzbDrone.Core.Jobs
|
|||
var sw = Stopwatch.StartNew();
|
||||
|
||||
_notificationProvider.Register(_notification);
|
||||
jobImplementation.Start(_notification, queueItem.TargetId, queueItem.SecondaryTargetId);
|
||||
jobImplementation.Start(_notification, queueItem.Options);
|
||||
_notification.Status = ProgressNotificationStatus.Completed;
|
||||
|
||||
settings.LastExecution = DateTime.Now;
|
||||
|
@ -296,7 +295,7 @@ namespace NzbDrone.Core.Jobs
|
|||
}
|
||||
|
||||
//Only update last execution status if was triggered by the scheduler
|
||||
if (queueItem.TargetId == 0)
|
||||
if (queueItem.Options == null)
|
||||
{
|
||||
SaveDefinition(settings);
|
||||
}
|
||||
|
@ -321,7 +320,5 @@ namespace NzbDrone.Core.Jobs
|
|||
logger.Trace("resetting queue processor thread");
|
||||
_jobThread = new Thread(ProcessQueue) { Name = "JobQueueThread" };
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue