diff --git a/Extractor/Pushers/CDFPusher.cs b/Extractor/Pushers/CDFPusher.cs index 45c0b79c..4e386293 100644 --- a/Extractor/Pushers/CDFPusher.cs +++ b/Extractor/Pushers/CDFPusher.cs @@ -379,28 +379,20 @@ await fdmDestination.PushNodes( if (isTimeseriesPushed && fdmDestination != null) { - tasks.Add(Task.Run(() => PushFdm(objects, variables, references, result, token))); + tasks.Add(PushFdm(objects, variables, references, result, token)); } if (!pushCleanAssets && assetsMap.Any()) { - tasks.Add( - Task.Run( - () => PushRawAssets(assetsMap, update.Objects, report, result, token) - ) - ); + tasks.Add(PushRawAssets(assetsMap, update.Objects, report, result, token)); } if (!pushCleanTimeseries) { - tasks.Add( - Task.Run( - () => PushRawTimeseries(timeseriesMap, update.Variables, report, result, token) - ) - ); + tasks.Add(PushRawTimeseries(timeseriesMap, update.Variables, report, result, token)); } - tasks.Add(Task.Run(() => PushReferences(references, report, result, token))); + tasks.Add(PushReferences(references, report, result, token)); await Task.WhenAll(tasks); @@ -531,7 +523,7 @@ CancellationToken token var timeseries = await CreateTimeseries( timeseriesMap, report, - config.SkipMetadata, + !pushCleanTimeseries || config.SkipMetadata, token ); @@ -539,7 +531,7 @@ CancellationToken token .Where(kvp => kvp.Value.Source != NodeSource.CDF) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - if (update.AnyUpdate && toPushMeta.Any()) + if (update.AnyUpdate && toPushMeta.Any() && pushCleanTimeseries) { await UpdateTimeseries(toPushMeta, timeseries, update, report, token); } @@ -1292,8 +1284,7 @@ private async Task UpdateTimeseries( IEnumerable timeseries, TypeUpdateConfig update, BrowseReport report, - CancellationToken token - ) + CancellationToken token) { var updates = new List(); var existing = timeseries.ToDictionary(asset => asset.ExternalId); @@ -1301,22 +1292,10 @@ CancellationToken token { if (existing.TryGetValue(kvp.Key, out var ts)) { - var tsUpdate = PusherUtils.GetTSUpdate( - fullConfig, - Extractor, - ts, - kvp.Value, - update, - nodeToAssetIds - ); - if (tsUpdate == null) - continue; - if ( - tsUpdate.AssetId != null - || tsUpdate.Description != null - || tsUpdate.Name != null - || tsUpdate.Metadata != null - ) + var tsUpdate = PusherUtils.GetTSUpdate(fullConfig, Extractor, ts, kvp.Value, update, nodeToAssetIds); + if (tsUpdate == null) continue; + if (tsUpdate.AssetId != null || tsUpdate.Description != null + || tsUpdate.Name != null || tsUpdate.Metadata != null) { updates.Add(new TimeSeriesUpdateItem(ts.ExternalId) { Update = tsUpdate }); } @@ -1325,12 +1304,7 @@ CancellationToken token if (updates.Any()) { - var res = await destination.UpdateTimeSeriesAsync( - updates, - RetryMode.OnError, - SanitationMode.Clean, - token - ); + var res = await destination.UpdateTimeSeriesAsync(updates, RetryMode.OnError, SanitationMode.Clean, token); log.LogResult(res, RequestType.UpdateTimeSeries, false); res.ThrowOnFatal(); @@ -1373,7 +1347,7 @@ CancellationToken token .Where(kvp => kvp.Value.Source != NodeSource.CDF) .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - if (update.AnyUpdate) + if (update.AnyUpdate && !config.SkipMetadata) { await UpdateRawTimeseries(toPushMeta, report, token); } diff --git a/Test/Unit/CDFPusherTest.cs b/Test/Unit/CDFPusherTest.cs index f301d52e..dfc3e508 100644 --- a/Test/Unit/CDFPusherTest.cs +++ b/Test/Unit/CDFPusherTest.cs @@ -34,6 +34,7 @@ public CDFPusherTestFixture() : base() public sealed class CDFPusherTest : IClassFixture, IDisposable { private readonly CDFPusherTestFixture tester; + private readonly ITestOutputHelper _output; private CDFMockHandler handler; private CDFPusher pusher; public CDFPusherTest(ITestOutputHelper output, CDFPusherTestFixture tester) @@ -43,6 +44,7 @@ public CDFPusherTest(ITestOutputHelper output, CDFPusherTestFixture tester) tester.ResetConfig(); (handler, pusher) = tester.GetCDFPusher(); tester.Client.TypeManager.Reset(); + _output = output; } public void Dispose()