Esempio n. 1
0
 public async Task GarbageCollectDataAsync(DataCollectionConfig dataCollectionConfig, IEnumerable <string> newFileNames, IEnumerable <IFileInfo> collectionFileInfos, CancellationToken cancellationToken)
 {
     try
     {
         await _dataCollector.GarbageCollectDataAsync(dataCollectionConfig, newFileNames, collectionFileInfos, cancellationToken);
     }
     catch (Exception e)
     {
         _logger.LogCritical("Error garbage collecting data '{dataCollectionName}': {errorMessage}", dataCollectionConfig.DataCollectionName, e.GetAggregateMessages());
         throw;
     }
 }
Esempio n. 2
0
        private async Task <IEnumerable <string> > CollectGroupAsync(string groupName, CollectorMode collectorMode, IEnumerable <DataCollectionConfig> dataCollectionsConfig, CancellationToken cancellationToken)
        {
            var result = new List <string>();

            foreach (var dataCollectionConfig in dataCollectionsConfig)
            {
                try
                {
                    var(newFileNames, collectionFileInfos) = await _dataCollector.CollectDataAsync(collectorMode, dataCollectionConfig, cancellationToken);

                    if (collectorMode == CollectorMode.Collect)
                    {
                        await _dataCollector.GarbageCollectDataAsync(dataCollectionConfig, newFileNames, collectionFileInfos, cancellationToken);
                    }
                }
                catch
                {
                    result.Add(dataCollectionConfig.DataCollectionName);
                    // Give other DataCollections a chance
                }
            }

            return(result);
        }