Converted jobs to dynamic

This commit is contained in:
Mark McDowall 2012-09-10 12:04:17 -07:00
commit a4dde81ceb
42 changed files with 166 additions and 170 deletions

View file

@ -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" };
}
}
}