<commit_before>﻿using System;
using System.IO;
using System.Threading.Tasks;
using FilterLists.Services.DependencyInjection.Extensions;
using FilterLists.Services.Snapshot;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace FilterLists.Agent
{
    public static class Program
    {
        private const int BatchSize = 1;
        private const string AppInsightsKeyConfig = "ApplicationInsights:InstrumentationKey";
        private static IConfigurationRoot configRoot;
        private static ServiceProvider serviceProvider;
        private static SnapshotService snapshotService;
        private static Logger logger;
        private static readonly TimeSpan OneHourTimeout = TimeSpan.FromHours(1);

        public static void Main()
        {
            BuildConfigRoot();
            BuildServiceProvider();
            snapshotService = serviceProvider.GetService<SnapshotService>();
            TryCaptureSnapshots().Wait();
        }

        private static void BuildConfigRoot() =>
            configRoot = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("appsettings.json", false)
                         .Build();

        private static void BuildServiceProvider()
        {
            var serviceCollection = new ServiceCollection();
            serviceCollection.AddFilterListsAgentServices(configRoot);
            serviceProvider = serviceCollection.BuildServiceProvider();<commit_msg>Revert "wait in main to ensure WasSuccessful set"<commit_after>﻿using System;
using System.IO;
using System.Threading.Tasks;
using FilterLists.Services.DependencyInjection.Extensions;
using FilterLists.Services.Snapshot;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace FilterLists.Agent
{
    public static class Program
    {
        private const int BatchSize = 1;
        private const string AppInsightsKeyConfig = "ApplicationInsights:InstrumentationKey";
        private static IConfigurationRoot configRoot;
        private static ServiceProvider serviceProvider;
        private static SnapshotService snapshotService;
        private static Logger logger;
        private static readonly TimeSpan OneHourTimeout = TimeSpan.FromHours(1);

        public static async Task Main()
        {
            BuildConfigRoot();
            BuildServiceProvider();
            snapshotService = serviceProvider.GetService<SnapshotService>();
            await TryCaptureSnapshots();
        }

        private static void BuildConfigRoot() =>
            configRoot = new ConfigurationBuilder()
                         .SetBasePath(Directory.GetCurrentDirectory())
                         .AddJsonFile("appsettings.json", false)
                         .Build();

        private static void BuildServiceProvider()
        {
            var serviceCollection = new ServiceCollection();
            serviceCollection.AddFilterListsAgentServices(configRoot);
            serviceProvider = serviceCollection.BuildServiceProvider();
{'fraction_non_alphanumeric': 0.06683722417652702, 'fraction_numerical': 0.0012791813239526704, 'mean_word_length': 2.8192918192918195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4311062', 'n_tokens_mistral': 678, 'n_tokens_neox': 660, 'n_words': 174}