public SourceStorageFor ( string sourceId ) : |
||
sourceId | string | |
Результат |
public void LearnInputForCommandResult(string input, AutoCompletionResult.CommandResult result) { if (result.IsTransient()) { return; } var storage = _sourceStorageFactory.SourceStorageFor(result.CompletionId.SourceId); storage.LearnCommandForInput(result.CompletionId, input); }
public void Execute() { if (!_scheduler.IsStarted) { return; } foreach (var jobKey in _scheduler.GetJobKeys(GroupMatcher <JobKey> .GroupEquals(JobGroupExporter.JobGroup))) { _scheduler.DeleteJob(jobKey); } foreach (var sourceAndStorage in _sourceStorageFactory.Sources.Select(s => new { Storage = _sourceStorageFactory.SourceStorageFor(s.Id), Source = s })) { IItemSource itemSource = sourceAndStorage.Source; SourceStorage sourceStorage = sourceAndStorage.Storage; var frequency = Configuration.GetFrequencyForItemSource(itemSource); if (itemSource.Persistent && frequency < Configuration.MinimumFrequencyForPersistentSources) { frequency = Configuration.MinimumFrequencyForPersistentSources; } var itemSourceName = itemSource.Id; var jobDetail = JobBuilder.Create <IndexerJob>() .WithIdentity("IndexerFor" + itemSourceName, JobGroupExporter.JobGroup) .Build(); jobDetail.JobDataMap[IndexerJob.SourceStorageKey] = sourceStorage; jobDetail.JobDataMap[IndexerJob.SourceKey] = itemSource; var trigger = TriggerBuilder.Create() .StartAt(DateBuilder.FutureDate(2, IntervalUnit.Second)) .WithSimpleSchedule(b => b.WithIntervalInSeconds(frequency) .RepeatForever() .WithMisfireHandlingInstructionNextWithRemainingCount()) .WithIdentity("Each" + frequency + "SecondsFor" + itemSource.Id) .Build(); _scheduler.ScheduleJob(jobDetail, trigger); } }