Exemple #1
0
 internal Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig,
                    IJobProcessor testProcessor, int sleepTime = 1000)
     : this(fileName, contextList, twitterConfig)
 {
     JobProcessors.Add(SchedulerJobType.Test, testProcessor);
     SleepTime = sleepTime;
 }
Exemple #2
0
        public Scheduler(string fileName, ITwitterContextList contextList, ITwitterConfiguration twitterConfig)
        {
            FileName = fileName;
            JobProcessors.Add(SchedulerJobType.DeleteStatus, new DeleteStatusProcessor(contextList));
            JobProcessors.Add(SchedulerJobType.CreateStatus, new CreateStatusProcessor(contextList, twitterConfig));

            if (File.Exists(FileName))
            {
                var json = File.ReadAllText(FileName);
                try
                {
                    Jobs.AddRange(JsonConvert.DeserializeObject <List <SchedulerJob> >(json));
                }
                catch (Exception ex)
                {
                    LogTo.WarnException("Failed to load joblist from file", ex);
                }
            }

            JobIdCounter = Jobs.Any()
                                ? Jobs.Max(j => j.JobId) + 1
                                : 0;

            SleepTime = 1000;
        }