/// <inheritdoc /> public Task <BoolResult> StartupAsync(Context context) { StartupStarted = true; return(StartupCall <BuildCacheCacheTracer> .RunAsync(_tracer, context, async() => { BoolResult result; _tracer.Debug(context, $"Creating ContentHashListAdapterFactory with {nameof(_useBlobContentHashLists)}={_useBlobContentHashLists}"); _contentHashListAdapterFactory = await ContentHashListAdapterFactory.CreateAsync( context, _buildCacheHttpClientFactory, _useBlobContentHashLists); Id = await _contentHashListAdapterFactory.BuildCacheHttpClient.GetBuildCacheServiceDeterminism(_cacheNamespace) .ConfigureAwait(false); var backingContentStoreTask = Task.Run(async() => await _backingContentStore.StartupAsync(context).ConfigureAwait(false)); var writeThroughContentStoreResult = _writeThroughContentStore != null ? await _writeThroughContentStore.StartupAsync(context).ConfigureAwait(false) : BoolResult.Success; var backingContentStoreResult = await backingContentStoreTask.ConfigureAwait(false); if (backingContentStoreResult.Succeeded && writeThroughContentStoreResult.Succeeded) { result = BoolResult.Success; } else { var sb = new StringBuilder(); if (backingContentStoreResult.Succeeded) { var r = await _backingContentStore.ShutdownAsync(context).ConfigureAwait(false); if (!r.Succeeded) { sb.Append($"Backing content store shutdown failed, error=[{r}]"); } } else { sb.Append($"Backing content store startup failed, error=[{backingContentStoreResult}]"); } if (writeThroughContentStoreResult.Succeeded) { var r = _writeThroughContentStore != null ? await _writeThroughContentStore.ShutdownAsync(context).ConfigureAwait(false) : BoolResult.Success; if (!r.Succeeded) { sb.Append(sb.Length > 0 ? ", " : string.Empty); sb.Append($"Write-through content store shutdown failed, error=[{r}]"); } } else { sb.Append(sb.Length > 0 ? ", " : string.Empty); sb.Append($"Write-through content store startup failed, error=[{writeThroughContentStoreResult}]"); } result = new BoolResult(sb.ToString()); } StartupCompleted = true; return result; })); }