Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        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);
            }
        }