public async Task SynchronizeSolutionAssetsAsync(Checksum solutionChecksum, CancellationToken cancellationToken) { var timer = new Stopwatch(); timer.Start(); // this will pull in assets that belong to the given solution checksum to this remote host. // this one is not supposed to be used for functionality but only for perf. that is why it doesn't return anything. // to get actual data GetAssetAsync should be used. and that will return actual data and if there is any missing data in cache, GetAssetAsync // itself will bring that data in from data source (VS) // one can call this method to make cache hot for all assets that belong to the solution checksum so that GetAssetAsync call will most likely cache hit. // it is most likely since we might change cache hueristic in future which make data to live a lot shorter in the cache, and the data might get expired // before one actually consume the data. using (Logger.LogBlock(FunctionId.AssetService_SynchronizeSolutionAssetsAsync, Checksum.GetChecksumLogInfo, solutionChecksum, cancellationToken)) { var syncer = new ChecksumSynchronizer(this); await syncer.SynchronizeSolutionAssetsAsync(solutionChecksum, cancellationToken).ConfigureAwait(false); } timer.Stop(); // report telemetry to help correlate slow solution sync with UI delays if (timer.ElapsedMilliseconds > 1000) { Logger.Log(FunctionId.AssetService_Perf, KeyValueLogMessage.Create(map => map["SolutionSyncTime"] = timer.ElapsedMilliseconds)); } }
public async Task SynchronizeSolutionAssetsAsync( Checksum solutionChecksum, CancellationToken cancellationToken ) { // this will pull in assets that belong to the given solution checksum to this remote host. // this one is not supposed to be used for functionality but only for perf. that is why it doesn't return anything. // to get actual data GetAssetAsync should be used. and that will return actual data and if there is any missing data in cache, GetAssetAsync // itself will bring that data in from data source (VS) // one can call this method to make cache hot for all assets that belong to the solution checksum so that GetAssetAsync call will most likely cache hit. // it is most likely since we might change cache hueristic in future which make data to live a lot shorter in the cache, and the data might get expired // before one actually consume the data. using ( Logger.LogBlock( FunctionId.AssetService_SynchronizeSolutionAssetsAsync, Checksum.GetChecksumLogInfo, solutionChecksum, cancellationToken ) ) { var syncer = new ChecksumSynchronizer(this); await syncer .SynchronizeSolutionAssetsAsync(solutionChecksum, cancellationToken) .ConfigureAwait(false); } }
public async Task SynchronizeAssetsAsync(IEnumerable <Checksum> checksums, CancellationToken cancellationToken) { // if caller wants to get different kind of assets at once, he needs to first sync asserts and use // GetAssetAsync to get those. var syncer = new ChecksumSynchronizer(this); await syncer.SynchronizeAssetsAsync(checksums, cancellationToken).ConfigureAwait(false); }
public async Task <List <ValueTuple <Checksum, T> > > GetAssetsAsync <T>( IEnumerable <Checksum> checksums, CancellationToken cancellationToken ) { // this only works when caller wants to get same kind of assets at once // bulk synchronize checksums first var syncer = new ChecksumSynchronizer(this); await syncer.SynchronizeAssetsAsync(checksums, cancellationToken).ConfigureAwait(false); var list = new List <ValueTuple <Checksum, T> >(); foreach (var checksum in checksums) { list.Add( ValueTuple.Create( checksum, await GetAssetAsync <T>(checksum, cancellationToken).ConfigureAwait(false) ) ); } return(list); }