示例#1
0
        /// <inheritdoc />
        protected override async Task <BoolResult> ShutdownCoreAsync(OperationContext operatonContext)
        {
            await _pinContext.DisposeAsync();

            var statsResult = await Store.GetStatsAsync(operatonContext);

            if (statsResult.Succeeded)
            {
                statsResult.CounterSet.LogOrderedNameValuePairs(s => Tracer.Debug(operatonContext, s));
            }

            return(BoolResult.Success);
        }
示例#2
0
        /// <inheritdoc />
        protected override async Task <BoolResult> ShutdownCoreAsync(OperationContext operationContext)
        {
            await _pinContext.DisposeAsync();

            var statsResult = await Store.GetStatsAsync(operationContext);

            if (statsResult.Succeeded)
            {
                Tracer.TraceStatisticsAtShutdown(operationContext, statsResult.CounterSet, prefix: "FileSystemContentSessionStats");
            }

            return(BoolResult.Success);
        }
示例#3
0
        public async Task AddPinThrowsOnDisposedPinContext()
        {
            var context = new Context(Logger);

            using (var taskTracker = new BackgroundTaskTracker(nameof(PinContextTests), context))
            {
                try
                {
                    var pinContext = new PinContext(taskTracker, contentHashes => { });
                    pinContext.AddPin(ContentHash.Random());
                    await pinContext.DisposeAsync();

                    Action addPinAction = () => pinContext.AddPin(ContentHash.Random());
                    addPinAction.Should().Throw <ObjectDisposedException>();
                }
                finally
                {
                    await taskTracker.ShutdownAsync(context);
                }
            }
        }