Exemplo n.º 1
0
        public async Task <HashSet <string> > GetVerifiedPackagesAsync()
        {
            var stopwatch = Stopwatch.StartNew();

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

                    using (var reader = await command.ExecuteReaderAsync())
                    {
                        var output = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                        while (await reader.ReadAsync())
                        {
                            var id = reader.GetString(0);
                            output.Add(id);
                        }

                        stopwatch.Stop();
                        _telemetryService.TrackReadLatestVerifiedPackagesFromDatabase(output.Count, stopwatch.Elapsed);

                        return(output);
                    }
                }
        }