public async Task ConfigureInstallationSetAsync(ResolvedInstallationSet installationSet, CancellationToken cancellation) { await _initializationHelper.Initialization.WithCancellation(cancellation); using (await _lock.LockAsync(cancellation)) { await ConfigureInstallationSetCoreAsync(installationSet, cancellation); } }
private async Task ConfigureInstallationSetCoreAsync(ResolvedInstallationSet installationSet, CancellationToken cancellation) { var resolvedReleases = installationSet.Resolved.ToHashSet(); var runningReleases = await GetSupervisorsAsync(cancellation); var union = resolvedReleases.Intersect(runningReleases.Keys).ToArray(); resolvedReleases.ExceptWith(union); foreach (var entry in union) { runningReleases.Remove(entry); } await Task.WhenAll(runningReleases.Select(p => UninstallAsync(p.Value, cancellation))); await Task.WhenAll(resolvedReleases.Select(p => InstallAsync(p, cancellation))); }