public Task CreateTaskAsync(ContentItem contentItem, IndexingTaskTypes type) { if (contentItem == null) { throw new ArgumentNullException("contentItem"); } if (contentItem.Id == 0) { // Ignore that case, when Update is called on a content item which has not be "created" yet return(Task.CompletedTask); } var indexingTask = new IndexingTask { CreatedUtc = _clock.UtcNow, ContentItemId = contentItem.ContentItemId, Type = type }; lock (_tasksQueue) { if (_tasksQueue.Count == 0) { ShellScope.AddDeferredTask(scope => FlushAsync(scope, _tasksQueue)); } _tasksQueue.Add(indexingTask); } return(Task.CompletedTask); }
public Task CreateTaskAsync(ContentItem contentItem, IndexingTaskTypes type) { if (contentItem == null) { throw new ArgumentNullException("contentItem"); } if (contentItem.Id == 0) { // Ignore that case, when Update is called on a content item which has not be "created" yet return(Task.CompletedTask); } var indexingTask = new IndexingTask { CreatedUtc = _clock.UtcNow, ContentItemId = contentItem.ContentItemId, Type = type }; if (_tasksQueue.Count == 0) { var tasksQueue = _tasksQueue; // Using a local var prevents the lambda from holding a ref on this scoped service. ShellScope.AddDeferredTask(scope => FlushAsync(scope, tasksQueue)); } _tasksQueue.Add(indexingTask); return(Task.CompletedTask); }
private void processingTaskFinished(object sender, IndexingTask task) { _log.Info($"end processing task {task.Action} #{task.ContentId} length:{task.FileLength}b attempt:{task.Attempts} {task.Path} resolution: {task.GetState()}"); IndexChangeTime = DateTime.UtcNow; IndexChanged?.Invoke(this, new EventArgs()); }
private IndexingTask createAdditionTaskForNewFile(long contentId, string content) { var fileName = _util.CreateFile("file", content: content); var rootEntry = new RootEntry <Metadata>(() => new Metadata(SequentialId.None)); var fileEntry = (FileEntry <Metadata>)rootEntry.Add(EntryType.File, fileName, new Metadata(contentId)); var task = new IndexingTask(IndexingAction.AddContent, fileEntry, CancellationToken.None); return(task); }
private static void indexingTaskProcessorFileOpened(object sender, IndexingTask task) { if (task.HardlinkPath == null) { Log.Error($"indexing failed to create hardlink to {task.Path}. Indexing in original location"); } else { Log.Debug($"indexing {task.Path} at hardlink {task.HardlinkPath}"); } }
private void processTask(IndexingTask task) { var stopwatch = new Stopwatch(); stopwatch.Start(); _taskProcessor.ProcessTask(task); stopwatch.Stop(); _log.Debug($"task {task.Action} #{task.ContentId} {task.Path} processed in {stopwatch.ElapsedMilliseconds}ms"); }
private static void processingTaskFinished(object sender, IndexingTask task) { Log.Debug($"facade end processing {task.Action} #{task.ContentId} length:{task.FileLength}b attempt:{task.Attempts} {task.Path} resolution: {task.GetState()}"); }
private static void processingTaskStarted(object sender, IndexingTask task) { Log.Debug($"facade begin processing {task.Action} #{task.ContentId} length:{task.FileLength}b attempt:{task.Attempts} {task.Path}"); }