public async Task Cleanup(bool isBootstrap) { await Task.WhenAll(Senders.Select(s => s.WaitForCurrentWorkToBeServiced()).ToList()); await Connections.Close(); if (collectHostEvents) { blobTelemetryListener.OnApplicationEvent(processId, invocationId.ToString(), $"Host {hostName}", "", OperationSide.Caller, OperationType.Host, stopwatch.Elapsed.TotalMilliseconds); } var blobname = await blobTelemetryListener.PushTelemetry(deploymentId, deploymentTimestamp, isBootstrap); if (blobname != null) { HostLogger.LogInformation($"telemetry written to {blobname}"); } CombinedLogger.Dispose(); }