Ejemplo n.º 1
0
        public async Task <SortedDictionary <string, SortedSet <string> > > GetPackageIdToOwnersAsync()
        {
            var stopwatch = Stopwatch.StartNew();

            using (var connection = await _connectionFactory.OpenAsync())
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = GetPackageIdToOwnersSql;

                    using (var reader = await command.ExecuteReaderAsync())
                    {
                        var builder = new PackageIdToOwnersBuilder(_logger);
                        while (await reader.ReadAsync())
                        {
                            var id       = reader.GetString(0);
                            var username = reader.GetString(1);

                            builder.Add(id, username);
                        }

                        var output = builder.GetResult();
                        stopwatch.Stop();
                        _telemetryService.TrackReadLatestOwnersFromDatabase(output.Count, stopwatch.Elapsed);

                        return(output);
                    }
                }
        }