private void FileSystemSnapshotManagerOnSnapshotScanFinished(object sender, SnapshotScanResult snapshotScanResult) { _stateChangeTaskQueue.ExecuteAsync(token => { _indexing = false; OnStatusUpdated(); }); }
private void FileSystemSnapshotManagerOnSnapshotScanFinished(object sender, SnapshotScanResult e) { // Skip file system scan errors and keep our current database if (e.Error != null) { return; } _taskQueue.Enqueue(ComputeNewStatedId, cancellationToken => { using (new TaskQueueGuard(this)) { ComputeNewStateLongTask(e.PreviousSnapshot, e.NewSnapshot, e.FullPathChanges, cancellationToken); } }); // Enqueue a GC at this point makes sense as there might be a lot of // garbage to reclaim from previous file contents stored in native heap. // By performin a full GC and waiting for finalizer, we ensure that (most) // orphan SafeHandles are released in a timely fashion. We enqueue a // separate task to ensure there is no potential state keeping these // variables alive for slightly too long. _taskQueue.Enqueue(GarbageCollectId, cancellationToken => { Logger.LogMemoryStats(); GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); GC.WaitForPendingFinalizers(); Logger.LogMemoryStats(); }); }
private void FileSystemSnapshotManagerOnSnapshotScanFinished(object sender, SnapshotScanResult e) { var fileSystemTreeComputed = new FileSystemScanFinished { OperationId = e.OperationInfo.OperationId, Error = ErrorResponseHelper.CreateErrorResponse(e.Error), }; if (e.PreviousSnapshot != null) { fileSystemTreeComputed.OldVersion = e.PreviousSnapshot.Version; fileSystemTreeComputed.NewVersion = e.NewSnapshot.Version; } _typedEventSender.SendEventAsync(fileSystemTreeComputed); }